If you’re using the WordPress shopping cart plugin WP Ecommerce and have version 3.6.9 or 3.6.10 RC1 or 3.6.10 RC2 and are using Google Checkout for your payment gateway, you may have noticed a problem. On the checkout page, there is a normal “Make Purchase” button like on all other payment gateways, but NOT the Google Checkout button like you might expect. You click “Make Purchase” and then you’re taken to a new blank page with only the Google Checkout button. At this point the Google Checkout button works, but it’s on a blank page which appears a bit odd.
The good news, is that past version 3.6.10 RC3 this issue has been resolved, but if you’re still using one of the above mentioned versions, here is the fix:
Locate the “shopping_cart.php” file in “wp-content/plugins/wp-shopping-cart/shopping_cart.php”. Open that file to edit it and locate this area of code near the bottom of the file:
if ($_POST['coupon_num']) { $_SESSION['nzshpcrt_totalprice'] = $total_after_discount; } else { $_SESSION['nzshpcrt_totalprice'] = $total; } echo " |
“.TXT_WPSC_ENTERDETAILS.”
“; include(‘checkout.php’); } else { echo TXT_WPSC_NOITEMSINTHESHOPPINGCART; } ?>
What you will do to fix it, is add this code into it:
//This is the code changed to fix Google Checkout bug. $gateway_options = get_option('custom_gateway_options'); if(array_search("google",(array)$gateway_options) !== false) { if (get_option('google_button_size') == '0'){ $google_button_size = 'BIG'; } elseif(get_option('google_button_size') == '1') { $google_button_size = 'MEDIUM'; } elseif(get_option('google_button_size') == '2') { $google_button_size = 'SMALL'; } $google_cart = unserialize($_SESSION['google_shopping_cart']); echo $google_cart->CheckoutButtonCode($google_button_size); } else { |
You’ll notice that there is a comment there notating where the fix is located. So you will then have a piece of code that looks like this at the end of your “shopping_cart.php” file:
if ($_POST['coupon_num']) { $_SESSION['nzshpcrt_totalprice'] = $total_after_discount; } else { $_SESSION['nzshpcrt_totalprice'] = $total; } //This is the code changed to fix Google Checkout bug. $gateway_options = get_option('custom_gateway_options'); if(array_search("google",(array)$gateway_options) !== false) { if (get_option('google_button_size') == '0'){ $google_button_size = 'BIG'; } elseif(get_option('google_button_size') == '1') { $google_button_size = 'MEDIUM'; } elseif(get_option('google_button_size') == '2') { $google_button_size = 'SMALL'; } $google_cart = unserialize($_SESSION['google_shopping_cart']); echo $google_cart->CheckoutButtonCode($google_button_size); } else { echo " |
“.TXT_WPSC_ENTERDETAILS.”
“; include(‘checkout.php’); } } else { echo TXT_WPSC_NOITEMSINTHESHOPPINGCART; } ?>
That’s it…problem solved.
Again, if you upgrade or have a newer version listed above, this fix is already incorporated.
So until next time…
Xavier says
I had Wp-Ecommerce Shopping Cart version 3.6.9 and I didn't want to risk upgrading to a newer version in fear of losing some of the modifications I had made to some files without logging. I contacted shayne and he linked me to this page. I applied the fix and it worked perfectly for us users below the latest updates. Thanks a lot!
Chase Stockton says
Shayne,
I am struggling to get my google checkout function to work on the checkout page. I don't have any Google Checkout logo, on 'checkout' nothing happens, nothing is sent to google checkout. Any help would be greatly apprecited.
http://www.steffenstore.com/products-page/tools/
Jason says
I'm having trouble getting the Google checkout to work. Whenever I check out it redirects me back to the check out page. Any suggestions?
shayne says
Jason –
This post is old obviously…and this should be fixed in newer versions…what version are you using?