Jump to content

Products in Google Merchant account disabld because of 6 decimals in source code for Product price


krisdv

Recommended Posts

Hi,

 

How is it possible to adjust the digits on the product price to only 2 decimals.

 

I noticed that in a recent update (https://github.com/PrestaShop/PrestaShop/pull/5836 ) it changed to 6 but now my google merchant account disables my products because the list price 329.00 doesn't correspond with the prices in the source code 328.999999 how can this be reversed. Do I have to update all the files again affected by the above mentioned change?

 

 

Link to comment
Share on other sites

Where does the price value get created for Google Merchant? At that location in the code, you could round that value and that should work!

 

That might even be a one-liner, as rounding is simply round($value, 2) in PHP. That is, assuming you want the default rounding behaviour. You can find out more about these here http://php.net/manual/en/function.round.php

Edited by Apium (see edit history)
Link to comment
Share on other sites

Google robot is just scanning the product page, in this case it finds, var productPrice=328.999999 while I have the product uploaded in Google with a product price of 329.00

 

I have searched product.tpl to modify the code but it doesn't look the be in there.

Link to comment
Share on other sites

  • 1 year later...

i had the same problem and i found a solution for that:

Product.tpl in your theme folder, modify

<span id="our_price_display" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>

to

<span id="our_price_display" itemprop="price" content="{convertPrice price=$productPrice|floatval}">{convertPrice price=$productPrice|floatval}</span>

Now Google approves this

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...