[Skip to main content](#vessel-content)

#   google checkout is not applying any coupon codes

##

- **[wrworkman](/forum/user/5017-wrworkman "View wrworkman's Profile")**
- [![wrworkman's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5017-wrworkman "View wrworkman's Profile") Topic Author
- [ Offline](/forum/user/5017-wrworkman)

Less More

- Posts: 24
- Thank you received: 0
-
-

14 years 7 months ago [\#42484](#42484) by [wrworkman](/forum/user/5017-wrworkman "View wrworkman's Profile")  *[google checkout is not applying any coupon codes](/forum/3-bug-report/42484-google-checkout-is-not-applying-any-coupon-codes#42484 "The discounted amount shows on my checkout page and in my sales history, but the customers order on google checkout is not receiving the discount information so it charges them the full price,...")* was created by *[wrworkman](/forum/user/5017-wrworkman "View wrworkman's Profile")*

The discounted amount shows on my checkout page and in my sales history, but the customers order on google checkout is not receiving the discount information so it charges them the full price, [ www.germfreetoothbrush.com](http://www.germfreetoothbrush.com) you need to order 3 or more to see

I attached the two screen prints.

I am not sure if it is applicable but I changed the original code so each item would show in google checkout

I also attached a copy of my google php

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80MjQ4NC1nb29nbGUtY2hlY2tvdXQtaXMtbm90LWFwcGx5aW5nLWFueS1jb3Vwb24tY29kZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[wrworkman](/forum/user/5017-wrworkman "View wrworkman's Profile")**
- [![wrworkman's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5017-wrworkman "View wrworkman's Profile") Topic Author
- [ Offline](/forum/user/5017-wrworkman)

Less More

- Posts: 24
- Thank you received: 0
-
-

14 years 7 months ago -  14 years 7 months ago [\#42485](#42485) by [wrworkman](/forum/user/5017-wrworkman "View wrworkman's Profile")  Replied by *[wrworkman](/forum/user/5017-wrworkman "View wrworkman's Profile")* on topic *[Re: google checkout is not applying any coupon codes](/forum/3-bug-report/42484-google-checkout-is-not-applying-any-coupon-codes#42485 "The discounted amount shows on my checkout page and in my sales history, but the customers order on google checkout is not receiving the discount information so it charges them the full price,...")*

Code:

&lt;?php function onAfterOrderConfirm(&amp;$order,&amp;$methods,$method_id) { $method =&amp; $methods[$method_id]; $currencyClass = hikashop::get('class.currency'); $currencies = null; $currencies = $currencyClass-&gt;getCurrencies($order-&gt;order_currency_id,$currencies); $currency = $currencies[$order-&gt;order_currency_id]; hikashop::loadUser(true,true); //reset user data in case the emails were changed in the email code $user = hikashop::loadUser(true); $lang = &amp;JFactory::getLanguage(); $locale = strtolower(substr($lang-&gt;get('tag'),0,2)); $httpsHikashop = str_replace('http://','https://', HIKASHOP_LIVE); $notify_url = $httpsHikashop.'index.php?option=com_hikashop&amp;ctrl=checkout&amp;task=notify&amp;notif_payment=googlecheckout&amp;tmpl=component&amp;lang='.$locale; $return_url = $httpsHikashop.'index.php?option=com_hikashop&amp;ctrl=checkout&amp;task=notify&amp;notif_payment=googlecheckout&amp;tmpl=component&amp;user_return=1&amp;lang='.$locale; $app =&amp; JFactory::getApplication(); $address = $app-&gt;getUserState( HIKASHOP_COMPONENT.'.billing_address'); $price = round($order-&gt;cart-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax,(int)$currency-&gt;currency_locale['int_frac_digits']); $data = '&lt;'.'?xml version="1.0" encoding="UTF-8"?'.'&gt;'."\n"; $data .= '&lt;checkout-shopping-cart xmlns="checkout.google.com/schema/2"&gt;&lt;shopping-cart&gt;&lt;items&gt;'; foreach($order-&gt;cart-&gt;products as $product){ $data .= '&lt;item&gt;&lt;item-name&gt;Order #'.$order-&gt;order_id.' - '.$product-&gt;order_product_name.'&lt;/item-name&gt;&lt;item-description&gt;&lt;/item-description&gt;&lt;unit-price currency="'.$currency-&gt;currency_code.'"&gt;'.$product-&gt;order_product_price.'&lt;/unit-price&gt;&lt;quantity&gt;'.$product-&gt;order_product_quantity.'&lt;/quantity&gt;&lt;/item&gt;'; } $data .= '&lt;item&gt;&lt;item-name&gt;Order #'.$order-&gt;order_id.' - Shipping&lt;/item-name&gt;&lt;item-description&gt;&lt;/item-description&gt; &lt;unit-price currency="'.$currency-&gt;currency_code.'"&gt;'.$order-&gt;order_shipping_price.'&lt;/unit-price&gt;&lt;quantity&gt;1&lt;/quantity&gt;&lt;/item&gt;'; $data .= '&lt;/items&gt;&lt;/shopping-cart&gt;&lt;checkout-flow-support&gt;&lt;merchant-checkout-flow-support/&gt;&lt;/checkout-flow-support&gt;&lt;/checkout-shopping-cart&gt;'; if( $method-&gt;payment_params-&gt;debug ) { echo 'XML Sent to Google&lt;pre&gt;'.htmlentities($data).'&lt;/pre&gt;'; } if( $method-&gt;payment_params-&gt;server_to_server == true ) { $ret =&amp; $this-&gt;webCall('checkout', $data, $method-&gt;payment_params); if( $ret !== false ) { if( preg_match('#&lt;redirect-url&gt;(.*)&lt;/redirect-url&gt;#iU', $ret, $redirect) ) { $redirect = html_entity_decode(trim($redirect[1])); $app =&amp; JFactory::getApplication(); $app-&gt;redirect($redirect); } if( $method-&gt;payment_params-&gt;debug ) { echo 'Google call return&lt;pre&gt;'.htmlentities($ret).'&lt;/pre&gt;'; } } $url = ''; $vars = ''; $app =&amp; JFactory::getApplication(); $app-&gt;enqueueMessage('Google Checkout error. Please log-in to the backend of Google Checkout to see the log.'); } else { $vars = array( 'signature' =&gt; base64_encode($this-&gt;signature($data, $method-&gt;payment_params-&gt;merchant_key)), 'cart' =&gt; base64_encode($data) ); if( $method-&gt;payment_params-&gt;sandbox ) { $url = 'https://sandbox.google.com/checkout/api/checkout/v2/checkout/Merchant/'; } else { $url = 'https://checkout.google.com/api/checkout/v2/checkout/Merchant/'; } $url .= $method-&gt;payment_params-&gt;merchant_id; } JHTML::_('behavior.mootools'); $app =&amp; JFactory::getApplication(); $name = $method-&gt;payment_type.'_end.php'; $path = JPATH_THEMES.DS.$app-&gt;getTemplate().DS.'hikashoppayment'.DS.$name; if(!file_exists($path)){ if(version_compare(JVERSION,'1.6','&lt;')){ $path = JPATH_PLUGINS .DS.'hikashoppayment'.DS.$name; }else{ $path = JPATH_PLUGINS .DS.'hikashoppayment'.DS.$method-&gt;payment_type.DS.$name; } if(!file_exists($path)){ return true; } } require($path); return true; }

Last edit: 14 years 7 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile"). Reason: adding code tags

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80MjQ4NC1nb29nbGUtY2hlY2tvdXQtaXMtbm90LWFwcGx5aW5nLWFueS1jb3Vwb24tY29kZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86315
- Thank you received: 14276
-
-

14 years 7 months ago [\#42652](#42652) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: google checkout is not applying any coupon codes](/forum/3-bug-report/42484-google-checkout-is-not-applying-any-coupon-codes#42652 "The discounted amount shows on my checkout page and in my sales history, but the customers order on google checkout is not receiving the discount information so it charges them the full price,...")*

I can see that you changed the code of that plugin so that it displays each product in the cart on google checkout instead of just the total price.
You forgot to handle the coupon price so of google checkout won't take it into account.

If you revert to the default google checkout plugin code, you won't have that problem.

Otherwise, you can add such code after the shipping handling code in order to handle the coupon: Code:

$data .= '&lt;item&gt;&lt;item-name&gt;Order #'.$order-&gt;order_id.' - Coupon&lt;/item-name&gt;&lt;item-description&gt;&lt;/item-description&gt; &lt;unit-price currency="'.$currency-&gt;currency_code.'"&gt;-'.$order-&gt;order_discount_price.'&lt;/unit-price&gt;&lt;quantity&gt;1&lt;/quantity&gt;&lt;/item&gt;';

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80MjQ4NC1nb29nbGUtY2hlY2tvdXQtaXMtbm90LWFwcGx5aW5nLWFueS1jb3Vwb24tY29kZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[wrworkman](/forum/user/5017-wrworkman "View wrworkman's Profile")**
- [![wrworkman's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5017-wrworkman "View wrworkman's Profile") Topic Author
- [ Offline](/forum/user/5017-wrworkman)

Less More

- Posts: 24
- Thank you received: 0
-
-

14 years 7 months ago [\#42709](#42709) by [wrworkman](/forum/user/5017-wrworkman "View wrworkman's Profile")  Replied by *[wrworkman](/forum/user/5017-wrworkman "View wrworkman's Profile")* on topic *[Re: google checkout is not applying any coupon codes](/forum/3-bug-report/42484-google-checkout-is-not-applying-any-coupon-codes#42709 "The discounted amount shows on my checkout page and in my sales history, but the customers order on google checkout is not receiving the discount information so it charges them the full price,...")*

works like a champ, thanks for the help and quick response

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80MjQ4NC1nb29nbGUtY2hlY2tvdXQtaXMtbm90LWFwcGx5aW5nLWFueS1jb3Vwb24tY29kZXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.111 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
