Posted on

Google Checkout disabled – Not available with these items

I was recently asked for help on a Google Checkout problem where the Google Checkout Button on the Magento cart page was disabled with a message saying: “Not available with these items“.

I had a look at the Magento store in question and found a few clues to go on but a
Google search on the subject proved to be of little help unfortunately. The button looks like the one shown in the screenshot below:

The disabled Google Checkout button on the Magento cart/checkout screen. It looks like the normal one only greyed out.
The disabled Google Checkout button on the Magento cart/checkout screen. It looks like the normal one only greyed out.

The underlying URL for the button is:

 <img src="https://checkout.google.com/buttons/checkout.gif?merchant_id=5677186919&amp;w=180&amp;h=46&amp;style=white&amp;variant=disabled&amp;loc=en_US" alt="Fast checkout through Google" />

The big clue was the parameter on the Google Checkout button image URL on the problem store. It had variant=disabled which is generated server side, and so had to be coming from somewhere within Magento. A big fat grep over the code uncovered a variant=' string fragment in Link.php.

Here is the code in context you can see that the variant is set to disabled if the getIsDisabled() returns true:

 public function getImageUrl()
    {
        $url = 'https://checkout.google.com/buttons/checkout.gif';
        $url .= '?merchant_id='.Mage::getStoreConfig('google/checkout/merchant_id');
        $v = $this->getImageStyle();
        $url .= '&w='.$v[0].'&h='.$v[1].'&style='.$v[2];
        $url .= '&variant='.($this->getIsDisabled() ? 'disabled' : 'text');
        $url .= '&loc='.Mage::getStoreConfig('google/checkout/locale');
        return $url;
    }

Further along in the same class we find:

      public function getIsDisabled()
    {
        $quote = Mage::getSingleton('checkout/session')->getQuote();
        /* @var $quote Mage_Sales_Model_Quote */
        foreach ($quote->getAllVisibleItems() as $item) {
            /* @var $item Mage_Sales_Model_Quote_Item */
            if ($item->getProduct()->getDisableGooglecheckout()) {
                return true;
            }
        }
        return false;
    }

So there it is, there is some sort of switch in Magento here which tells a product to either be enabled or disabled for Google Checkout. This is one of my pet peeves with the EAV architecture Magento employs. It’s quite tricky to then find the actual place where this data is stored/defined. Liberal use of grep did uncover what I was looking for in an sql upgrade script:

$installer->addAttribute('catalog_product', 'disable_googlecheckout', array(
        'type'              => 'int',
        'backend'           => '',
        'frontend'          => '',
        'label'             => 'Not available for purchase with Google Checkout',
        'input'             => 'select',
        'class'             => '',
        'source'            => 'eav/entity_attribute_source_boolean',
        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
        'visible'           => true,
        'required'          => false,
        'user_defined'      => false,
        'default'           => '0',
        'searchable'        => false,
        'filterable'        => false,
        'comparable'        => false,
        'visible_on_front'  => false,
        'unique'            => false,
        'apply_to'          => '',
        'is_configurable'   => false
    ));

So now a quick survey of the Product Admin tabs uncovered this on the Price Tab – don’t ask me why this is a price option, but nevertheless that is where it resides:

Even if it's not immediately obvious why the enabling/disabling of a product for Google checkout is a price related option, this is where it is located.
Even if it's not immediately obvious why the enabling/disabling of a product for Google checkout is a price related option, this is where it is located.

Here you will find the option drop down, as shown below:

This drop down let's you select whether a product can be sold via Google Checkout.
This drop down let's you select whether a product can be sold via Google Checkout.

This was a feature introduced in Magento 1.2 to help stores that want to use Google Checkout but have some products which may breach the Google Checkout policies. Great idea.

The question remains, and hopefully we will find out, if somehow the setting has been turned on for the user who posted a comment having difficulty with this disabled Google Checkout button during Magento checkout.

14 thoughts on “Google Checkout disabled – Not available with these items

  1. I upgraded and had this issue and had no clue it was a new magento “feature.” I assumed my upgrade was broken. 🙁

    Thank you for this detailed post! Saved me hours of debugging. 🙂

  2. Thank you! Exactly what I needed to know.

  3. I just ran into this after upgrading to 1.3.0.

    Does this mean that I will have to manually update HUNDREDS of products to “Yes” or is there a global setting somewhere? I’ve searched around and don’t see a global setting but thought perhaps someone else has found it.

    Thanks!

  4. You can bulk update magento products by doing this:
    1) Go to Catalog -> Manage products
    2) Click the ‘select all’ link and it should show ‘X items selected’
    3) Under the Actions drop down choose ‘update attributes’ then submit.
    4) This takes you to a bulk update page, where you can choose to change the Google Checkout status for all of your products.

    If you have 1000’s of products this might time out or crash. In which case let me know because I will write some SQL to do it and post it here. But only if there is a need for it.

    Cheers,
    Ashley

  5. Much needed SQL update script for this problem. I want to fix the database once and for all, as at present I simply disable this check.
    1000’s of products, so yes, Magento WILL crash..

  6. I have google checkout enabled, but i get the grayed out logo. If you click the logo it takes you to checkout. Am I missing something in your fix. Do I have to manually override it somehow?

  7. That’s really odd, because normally if it is grey you can’t click it. Can you check the URL of the image?

  8. Great post! Just wanted to let you know you have a new subscriber- me!

  9. You could just change the function in /app/code/core/Mage/GoogleCheckout/Block/Link.php to reverse the check:

    public function getIsDisabled()
    {
    $quote = Mage::getSingleton(‘checkout/session’)->getQuote();
    /* @var $quote Mage_Sales_Model_Quote */
    foreach ($quote->getAllVisibleItems() as $item) {
    /* @var $item Mage_Sales_Model_Quote_Item */
    if (!$item->getProduct()->getEnableGooglecheckout()) {
    return false;
    }
    }
    return true;
    }

  10. @Greg Don’t change core files!. Also that might mean that new products (where the boolean is correct) would be disabled instead of enabled? Certainly if you do what Greg suggests, make a local copy of the core file, and test it first before making the change in production.

  11. @Ashley.. You are right, my bad. Although for anyone in my position where I have 90K products and want all of them available via Google Checkout it is an option… The script works, but on that many products it takes a while, and with daily updates it may never end!

  12. Ashley,

    Thanks for posting this, I was bitten by the exact same problem. Products->Prices — sneaky place to hide this Google Checkout setting, since pricing has nothing to do with checkout.

  13. greate just what i wanted

Comments are closed.