0

I use Magento 2.4.3.

I created custom shipping extension. It works correct.

But now I would like to add calculating by width, height, length params of product. I've added these params (width, height, length) to product attribute set. It's easy.

My question - how I can get these these params (width, height, length) in method collectRates() my custom shipping extrension?

I see $request->getPackageWeight(), $request->getBaseSubtotalInclTax(). Is there method(s) to get custom product attribute in $request?

Thanks.

1 Answer 1

1

Directly in request there is no such value. But you can get quote items $request->getAllItems() . Do foreach, get item, then product from it (or load it by id/sku) and get required values from product.

1
  • Thank you. Your answer was helpful to me.
    – PHPer
    Dec 8, 2021 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.