This repository was archived by the owner on Aug 2, 2022. It is now read-only.
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
Set Different Shipping Method for Each Order #31
Open
Description
I am able to split the order based on the Stock Status but the problem i am facing is when i am trying to set shipping method to the order.
Actually i want to set different Shipping Method to both the order.
e.g. first Order i want to set Shipping as free shipping and 2nd as Flat rate.
Below is the code used to set the shipping method for 2nd order but i am getting The shipping method is missing. Select the shipping method and try again.
$quote->getShippingAddress()->setShippingAmount($total)
->setShippingMethod('freeshipping_freeshipping');
Also Tried Below Code Same Issue. The shipping method is missing. Select the shipping method and try again.
use Magento\Quote\Model\Quote\Address\Rate
$this->shippingRate
->setCode('freeshipping_freeshipping')
->setCarrierTitle($carrierTitle)
->setPrice($total);
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setCollectShippingRates(true)
->collectShippingRates()
->setShippingMethod('freeshipping_freeshipping');
$quote->getShippingAddress()->addShippingRate($this->shippingRate);
Please Help