Posted on

Magento 1.1.7 Google Checkout and Free Shipping (part 2)

In my last post I showed how to correct the problem that was causing Magento to generate invalid XML for Google Checkout. In this post I will show how to fix another Magento problem with Free Shipping over $X and Google Checkout.

The issue is that even though free shipping shows correctly on the webstore – when Google Checkout makes the merchant calculation callback free shipping is not returned as an option when it should be.

The fix is actually a very simple one-liner. When calculating the available rates for the cart page Magento forms a request like this:

(from app/code/core/Mage/Sales/Model/Quote/Address.php around line 502)

$request->setDestStreet($this->getStreet(-1));
$request->setDestCity($this->getCity());
$request->setDestPostcode($this->getPostcode());
$request->setPackageValue($this->getBaseSubtotal());
$request->setPackageValueWithDiscount($this->getBaseSubtotalWithDiscount());
$request->setPackageWeight($this->getWeight());
$request->setPackageQty($this->getItemQty());

However in the Shipping model (app/code/core/Mage/Shipping/Model/Shipping.php) a request is built without this call:

$request->setPackageValueWithDiscount($address->getBaseSubtotalWithDiscount());

Which means the free shipping calculation never gets the right value and so never returns true. The fix is to just add that line into app/code/core/Mage/Shipping/Model/Shipping.php around line 157.
This should cause your free shipping to calculate correctly in Magento when Google Checkout makes a merchant calculation request.

With the two fixes I have outlined here, the Google Checkout intergration on my webstore now works perfectly well. I’m very happy with the results. It is much better than using the flat rate Google Checkout shipping option – which is what I had been doing.

On the Magento forums I have read about a lot of the problems people are having with Google Checkout callbacks and the calculations in general. In my next post I will try to create a simple checklist that will help you to troubleshoot google checkout problems.

Edit: This is still an issue in Magento 1.2.1.

8 thoughts on “Magento 1.1.7 Google Checkout and Free Shipping (part 2)

  1. hi, is this still work for v1.3.2?

    I am still not able to bring up the free shipping following your method.

  2. I haven’t tried it it in Magento 1.3.2 yet, it was basically a workaround so it’s posible they have fixed it? Did the free shipping not work with no changes either?

  3. forgot about my question here. Free shipping is still not working for me using latest version.

  4. We’re running Magento 1.3.1, and it appears it hasn’t been fixed. When a user is directed to the Google page, free shipping shows for 5 seconds, then the shipping dropdown is populated with the Carrier Calculated shipping. I’m thinking that Magento correctly sends “free shipping” to GC, but it gets over-written by the carrier-calculated shipping.

  5. I’m not sure that carrier calculated and merchant calculated options in Google Checkout being used together will be workable with Magento? You’ll be able to see if free is being passed by checking the google checkout debug log. In the next week or so I’ll be doing a google checkout + magento 1.3.2 integration, and promise I’ll do an updated blog post after I figure out how to fix it up. It’s annoying though huh over 6 months and it’s still broken?!

  6. Hi Ashley, thanks for the follow up. I will make sure to remember to visit your site.

  7. Just to add that this fix is included in the latest version now.

  8. Hey Ashley, from I understand this fix no longer works because the code was updated.
    Have you come across a fix that would work on Magento 1.7?

Comments are closed.