Ok so i have a very strange issue with creating an order programatically in which it works perfectly fine when using freeshipping_freeshipping or a non weight based shipping method. This order saves and invoices correctly.
The issue i am having is using matrix rates as the shipping method, so i set the quote shipping address collect totals and set premium_(matrix rate name) as the shipping method, and the order throws an exception "Please specifify shipping method" this comes back to quite deep in magento core on virtual, method and rate shipping address check.
Any help in working out why the rate is always null causing this exception to be thrown would be much appreciated.
// Start New Sales Order Quote $quote = Mage::getModel('sales/quote'); //set the currency for the order to gbp even though the prices are euros $quote->setCurrency('GBP'); $quote->assignCustomer($customer); //the below 2 are used in orer to stop quantity errors $quote->setIsSuperMode(true); $quote->setInventoryProcessed(true); //we dont want to bother the customer again. $quote->setSendCconfirmation(0); $billingAddress = $quote->getBillingAddress()->importCustomerAddress($address); $shippingAddress = $quote->getShippingAddress()->importCustomerAddress($address); $quote->getShippingAddress()->collectTotals(); $shippingAddress->setCollectShippingRates(true)->collectShippingRates(); $shippingAddress->setShippingMethod($shipping_method)->setCollectShippingRates(true); $quote->getPayment()->importData(array('method' => $payment_method)); $quote->collectTotals()->save();