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.

You might also be interested in:

  1. Magento 1.1.7 Google Checkout and Free Shipping
  2. 3 Quick Methods To Diagnose Communication Problems between Magento and Google Checkout
  3. Magento 1.2.0.1 Fails when using Google Checkout Merchant Calculated Shipping Callbacks: An HTTPS URL is required.
  4. Magento 1.4.0.1 Tax Calculation error – Out by a factor of 100
  5. Google Checkout disabled – Not available with these items


Tagged as , , , , + Categorized as Google Checkout, Magento, Web Development

6 Comments

  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.

Leave a Comment

Name:

Email:

Website:

Sporadic Tweeting...

  • My Top 3 Weekly #lastfm artists: The Black Keys (86), Mos Def (9) and Foo Fighters (8) http://bit.ly/c6eW5I 4 days ago
  • Finally beaten the 'Invalid package.xml format' fluff when trying to upload to Magento Connect - latest SMTP finally available there - yah! 4 days ago
  • My latest post includes a guide to making a basic extension too, so if you're just starting out with Magento extensions, check it out. 5 days ago
  • More updates...

What I'm listening to

  • The Black Keys - Brothers
  • Mos Def - Black On Both Sides
  • Foo Fighters - Skin and Bones
  • The Black Keys - Chulahoma
  • The White Stripes - Icky Thump
  • The Naked and Famous - This Machine
  • The Black Keys - The Moan
  • Red Hot Chili Peppers - Blood Sugar Sex Magik
  • Fat Freddys Drop - Based on a True Story