1

I am trying to set the shipping merthod in programatically created orders to a custom shipping method, here is a sample of my code...

setTelephone($shipping[Phone]);
// ->setFax($shipping->getFax());

$order->setShippingAddress($shippingAddress)->setShipping_method('flatrate_flatrate');

what am i doing wrong ?

2

You should set shipping method this way:

// Collect Rates and Set Shipping & Payment Method
$shippingAddress->setCollectShippingRates(true)
    ->collectShippingRates()
    ->setShippingMethod('flatrate_flatrate')
    ->setPaymentMethod('checkmo');

Check this answer for whole order creation

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.