Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Set Different Shipping Method for Each Order #31

Open
ninjacoder30 opened this issue Jun 25, 2019 · 0 comments
Open

Set Different Shipping Method for Each Order #31

ninjacoder30 opened this issue Jun 25, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@ninjacoder30
Copy link

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
@williankeller williankeller added the enhancement New feature or request label Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants