When using flat rate shipping options for Google Checkout, you can include a free delivery option.
However, when you click through to Google Checkout, the free option is missing. Google Checkout seems to see this option and discard it. Or does it?
In fact, this is Magento being helpful(?)
To cure this, you just need to edit /app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Checkout.php
You should be able to create a local version of the file (/app/code/local/…) if you don’t wish to edit the core file.
You’re looking for the following loop:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
for ($xml='', $i=1; $i< =3; $i++) { $allowSpecific = Mage::getStoreConfigFlag('google/checkout_shipping_flatrate/sallowspecific_'.$i, $this->getQuote()->getStoreId()); $specificCountries = Mage::getStoreConfig('google/checkout_shipping_flatrate/specificcountry_'.$i, $this->getQuote()->getStoreId()); $allowedAreasXml = $this->_getAllowedCountries($allowSpecific, $specificCountries); $title = Mage::getStoreConfig('google/checkout_shipping_flatrate/title_'.$i, $this->getQuote()->getStoreId()); $price = Mage::getStoreConfig('google/checkout_shipping_flatrate/price_'.$i, $this->getQuote()->getStoreId()); $price = number_format($price, 2, '.',''); $price = (float) Mage::helper('tax')->getShippingPrice($price, false, false); if (empty($title) ){# || $price < = 0) { continue; } $xml .= <<<EOT <{$nodeName} name="{$title}"> <shipping -restrictions> <allowed -areas> {$allowedAreasXml} </allowed> </shipping> <price currency="{$this->getCurrency()}">{$price}</price> EOT; } |
The only bit you’re really interested in though, is:
1 2 3 |
if (empty($title) || $price < = 0) { continue; } |
Change this to:
1 2 3 |
if (empty($title)) { continue; } |
And there you go – a free delivery option that you create will appear.
Image Credit: Thomas Hawk
Comment or tweet @douglasradburn