Variations & Google Checkout

So, if any of you use the Wordpress shopping cart plugin WP Ecommerce, first of all you’ll notice that it is a superb ecommerce solution for a Wordpress site. With that being said, there are some bugs here and there, which is to be expected I think…after all the plugin is free!

So, what I would like to address today is one of those bugs - passing variations on to Google Checkout.

Within WP Ecommerce you can set up variation sets, like for example: Small, Medium and Large if you are selling T-Shirts. Here’s where the bug comes in. If you’re using Google Checkout as your payment gateway, you’ll notice that the variations don’t get passed on to the Google Checkout page which makes it very difficult to know what exactly your customer ordered, besides just the product itself.

So, what you will need to do is FTP into your site and in “wp-contents/plugins/wp-shopping-cart/shopping_cart_functions.php” find this chunk of code (which starts on line 168 of my version which is 3.6.8 RC1):

if (array_search("google",get_option('custom_gateway_options')) !== false) {
				$google_item = new GoogleItem(utf8_decode($product['name']),utf8_decode($product['description']), $quantity, $google_unit_price);
				$google_item->SetMerchantItemId($product['id']);

				$google_cart->SetMerchantCalculations(get_option('siteurl'),"false","false","false");
				//echo serialize($cart_item->product_variations);
				$google_item->SetMerchantPrivateItemData("some variations");
				$google_cart->AddItem($google_item);
			}

The second line in that code is what you will want to change. Copy the code below and replace the second line in that chunk of code:

$google_item = new GoogleItem(utf8_decode($product['name'].$variation_list),utf8_decode($product['description']), $quantity, $google_unit_price);

That’s it! Now your shopping cart should pass the variation sets over to Google Checkout and you’ll know what your customers ordered!! Good luck and happy coding.

Until next time…

Related Posts

, , ,

This post was written by:

shayne - who has written 5 posts on S-Tastic Designs - Web Designer for Hire.

I'm Shayne...the guy behind S-Tastic Designs. You can read about me on the About page...but I'm a designer, developer and overall good guy! I also provide support for the Wordpress plugin WP Ecommerce.

Contact the author

Do you have a Gravatar yet? It's that cool icon next to your name. All you have to is click here to upload your own Gravatar for free. If you do, you'll see it by every comment you post on S-Tastic Designs and every other blog that supports Gravatars!

10 Comments For This Post

  1. Deanna had this to say :


    Variations still do not seem to get passed onto Google Checkout.

  2. shayne had this to say :


    That’s odd…I have tested it and retested it and it’s working on my test installation.

  3. Michael Mahoney had this to say :


    Yeah, it’s not working for me either. Has anyone gotten this to work?

  4. shayne had this to say :


    Hmm…if you want to contact me through the contact page and get me login info, I’ll take a look at it for you.

  5. Andrew had this to say :


    I can’t get this working either. please, please advise.

  6. Andrew had this to say :


    please respond to my post on this issue on the Instinct forums as soon as possible. your suggestions on the forums have been very helpful and i am grateful for them. sadly this issue is a major bump in the road.

    here is the link:

    http://www.instinct.co.nz/forums/topic.php?id=910&replies=24#post-11172

    with much appreciation,
    Andrew

    I am also on skype. please feel free to call me tomorrow (monday) 415.501.9651

  7. shayne had this to say :


    Hi Andrew,

    The issue should be resolved now…check this post:

    http://www.instinct.co.nz/forums/topic.php?id=910

  8. Deanna had this to say :


    Variations DO get passed onto Google Checkout now. :)

  9. Chris had this to say :


    Hi Shayne - Thanks for this - I just upgraded to RC3 and noticed that your fix for this appears to be included in the new version, however variations are not being passed through to Google - any thoughts?

    Thanks for all your work!

  10. shayne had this to say :


    Read the post on the link I posted above…that should fix it up.

What Do You Think?