문제

I am setting Shipping Method to quote, For one particular method, shipping price is not added to quote but for other shipping methods it is working fine. Can anyone suggest on this, I have used below code,

// Collect Rates and Set Shipping & Payment Method
                $quote->getShippingAddress()->setCollectShippingRates(true)->collectShippingRates();
                $quote->getShippingAddress()->setShippingMethod($postParams['shipping_method']);


                $quote->getShippingAddress()->setPaymentMethod($postParams['payment_method']);


                //Set Sales Order Payment
                $quote->getPayment()->importData(array('method' => $postParams['payment_method']));


                // Collect Totals & Save Quote
               $quote->collectTotals()->save();
도움이 되었습니까?

해결책

Finally, I got it fixed by using below code,

 $quote->getShippingAddress()->setCollectShippingRates(true)->collectShippingRates();

// Updated Line
                    $quote->getShippingAddress()->setShippingMethod($postParams['shipping_method'])->setCollectShippingRates(true);
// Updated Line

                    $quote->getShippingAddress()->setPaymentMethod($postParams['payment_method']);


                    //Set Sales Order Payment
                    $quote->getPayment()->importData(array('method' => $postParams['payment_method']));


                    // Collect Totals & Save Quote
                    $quote->collectTotals()->save();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top