phpgoogle-apigoogle-shopping

Price Formatting Google Content API for Shopping


Any Google Content API for Shopping gurus?

When submitting a price greater than 999.99 using the GShoppingContent.php library provided by Google I get a parse error that the API can't read the format of the price.

If I round the price up to even without the decimal places ie: only 4 digits it will submit successfully, but it then gets disapproved because it doesn't match the site price.

The number formatting on Google Shopping seems to suggest that they might want the thousands separator as they have prices as 1,234.99 so I also tried that format:

$price = number_format ($price, 2, '.', ',');

But I still get the error.

Does anyone know how to fix this issue?


Solution

  • $price = number_format ($price, 2, '.', '');

    $price = number_format ($price, 2);

    automatically add the , thousands separator by default, I missed that.