0

I want to set a shipping method in order to create an order, but i got the following message error: "Please specify a shipping method". This is my code: First try:

$shippingAddress->setFreeShipping( true )
            ->setCollectShippingRates(true)->collectShippingRates()
            ->setShippingMethod('freeshipping')
            ->setPaymentMethod('cashondelivery');

Second try:

$quote->getShippingAddress()->setShippingMethod('freeshipping');

None of these are not working. Any idea how to solve this is welcomed. Thx in advance

0

Make sure the freeshipping method is active and its rate exists in the Mage_Sales_Model_Resource_Quote_Address_Rate_Collection collection.

EDIT: Don't forget to check if the address you're setting the shipping method against is eventually saved.

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.