Posted on

Magento 1.1.7 Google Checkout and Free Shipping

I have been working with the Magento E-commerce platform and have to say it’s generally pretty slick. I ran into a problem though when trying to get the Google Checkout integration working. The error message in the Google Checkout integration console was:

"We were looking for data in your merchant-calculation-results, but were not
able to find it: result: address-id: XXXXXX"

The problem was that the XML response Magento was sending back had the correct calculations for each shipping method that was available but it didn’t include the shipping methods that were not available for the address. These are required according to the Google Checkout XML API Docs.

For example: if there are two shipping methods: standard and free – where free is only available to UK customers. The customer has 2 potential delivery addresses (One in the UK and one in the US).

The Google request would look something like this:

<?xml version="1.0" encoding="UTF-8"?>
        <item-weight value="0.6" unit="LB" />
        <item-name>Special Blue Widget</item-name>
        <unit-price currency="GBP">20</unit-price>
      <anonymous-address id="769875978986">
        <city>Demo City</city>
      <anonymous-address id="78648564865986">
        <postal-code>SP6 7AJ</postal-code>
        <city>UK Demo Town</city>
      <method name="Shipping - Free" />
      <method name="Shipping - Standard" />
    <merchant-code-strings />

Out of the box Magento would send back data for standard shipping for both addresses, free shipping is only included for the UK address.

<?xml version="1.0" encoding="utf-8"?>
<merchant-calculation-results xmlns="">
    <result shipping-name="Shipping - Standard" address-id="769875978986">
      <shipping-rate currency="GBP">10</shipping-rate>
      <total-tax currency="GBP">0</total-tax>
    <result shipping-name="Shipping - Standard" address-id="78648564865986">
      <shipping-rate currency="GBP">5</shipping-rate>
      <total-tax currency="GBP">0</total-tax>
    <result shipping-name="Shipping - Free" address-id="78648564865986">
      <shipping-rate currency="GBP">0</shipping-rate>
      <total-tax currency="GBP">0</total-tax>

The missing element is:

<result shipping-name="Shipping - Free" address-id="78648564865986">
   <shipping-rate currency="GBP">0</shipping-rate>

The fix is in Callback.php around line 216. You need to have an else condition like so:

if (isset($rates[$methodName])) {
    if ($this->getData('root/calculate/tax/VALUE')=='true') {
        $taxAmount = $address->getTaxAmount();
        $taxAmount += $billingAddress->getTaxAmount();
    $result->SetShippingDetails($methodName, $rates[$methodName], "true");
} else {
        $result->SetShippingDetails($methodName, 0, "false");

And then you will have the Google Checkout Callbacks working! There is another problem I found with the actual determination of free shipping eligibility. I’ll document the fix for that in my next post.

Edit: This is still an issue in Magento 1.2.1.

2 thoughts on “Magento 1.1.7 Google Checkout and Free Shipping

  1. Hi, I am receiving the following error for my store…

    Merchant Calculations: We were looking for data in your merchant-calculation-results, but were not able to find it: result: address-id:XXXXXXX

    On the surface the problem I seem to have is that Google checkout doesn’t process “per item” shipping. I am using the flat rate method and also an extension via the “merchant calculated” method.

    Any help would be fantastic ! ( I am really struggling)

    Many thanks


  2. Hi, Shane
    If you post your XML from the integration console, the parts that say ‘what we sent’ and ‘what you sent back’ (or words to that effect) – obviously you’d want to mask any sensitive info in the xml first! This might allow me to spot what is wrong. Cheers, Ashley

Comments are closed.