We use a custom checkout extension by Templates Master called "Firecheckout". Not sure if that's relevant, but figured I should mention it. Occasionally I see a transaction failed email with the reason being "Please specify a shipping method". I've spent a long time trying to track down how this can happen and I'm lost. I have tried everything I can think of to duplicate the issue. Depending on the combination of things I do (adding/removing items from the cart, adding/removing a coupon code that changes shipping options, switching between mobile and desktop sites, etc) I have been able to make it so that the checkout page doesn't have an option selected for shipping method. However, if I try to submit the order I get an immediate red message in the shipping method section that says "Please specify shipping method" (Note the difference between what it says in the email and what it says in the error displayed on the page...missing "a"). This does not result in an error email.
Searching through the code I find that the error email is triggered in the TM_FireCheckout_Model_Service_Quote (extends Mage_Sales_Model_Service_Quote) class in the _validate method
$method= $address->getShippingMethod();
$rate = $address->getShippingRateByCode($method);
if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
Mage::throwException($helper->__('Please specify a shipping method.'));
}
In this case, I guess either $method or $rate is null or false, but why/how could that be? Is there anything I could do to ensure this never happens? The only difference between the FireCheckout's _validate method and the parent class's _validate method is in which fields are considered required. It does not alter the address object in any way, so the subsequent calls to getShippingMethod and getShippingRateByCode should be the same as a default install.
I can provide additional details if necessary. I'm basically trying to understand what may trigger that error and how I can reproduce it so I can ultimately patch the hole that is causing it in the first place.
Thanks!
Mage::log("Firecheckout: " . var_dump($method) . " | " . var_dump($rate), null, 'mydebug.log', true);
to a local copy of Mage_Sales_Model_Service_Quote and tail this custom log file, perhaps add order and customer ID's as well to see if those values are persisting? – Cockneyfy