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):
1 2 3 4 5 6 7 8 9 | 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:
1 | $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…




November 19, 2008
Variations still do not seem to get passed onto Google Checkout.
November 21, 2008
That’s odd…I have tested it and retested it and it’s working on my test installation.
November 26, 2008
Yeah, it’s not working for me either. Has anyone gotten this to work?
November 26, 2008
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.
December 8, 2008
I can’t get this working either. please, please advise.
December 8, 2008
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
December 8, 2008
Hi Andrew,
The issue should be resolved now…check this post:
http://www.instinct.co.nz/forums/topic.php?id=910
December 9, 2008
Variations DO get passed onto Google Checkout now.
December 9, 2008
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!
December 10, 2008
Read the post on the link I posted above…that should fix it up.