Can anyone give the solution for the below. I am using magento 2 CE. I want to show all shipping methods for each item in the cart on the shopping cart page and the customer can select the shipping method seperately. How can i achieve this? please give the solution enter image description here

  • This question Does not showing any Research Efforts. Stack overflow is not a Code generator. you have to research and work yourself first. If not works and then only you need to ask here with your researched / tried codes. – Ask Bytes Aug 4 '19 at 8:02

Try this:

 //$objectManager is an instance of \Magento\Framework\ObjectManagerInterface

 $session = $objectManager->create('Magento\Checkout\Model\Session');

 $shipping = $session->_getCheckoutSession()->getQuote()->getShippingAddress();

 $methods  = $shipping->getGroupedAllShippingRates();
| improve this answer | |
  • Thanks for your reply. I want to show all the shipping methods for each item. The user can select one shipping method for first item[free shipping] and select another one [truck delivery] for another item. how to i make that selection process ? – Thanga sujitha Aug 4 '19 at 6:52
  • So in your template, use $method in each product ? And ofcourse you have to custom some tables (sales_order,..) to save shipping method for each item in an order. – Hieu Pham Minh Aug 4 '19 at 7:38
  • Okay. Thank you. I will try and get back to you. – Thanga sujitha Aug 4 '19 at 7:49

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.