woocommerce / google-listings-and-ads

Sync your store with Google to list products for free, run paid ads, and track performance straight from your store dashboard.
https://woo.com/products/google-listings-and-ads/
GNU General Public License v3.0
44 stars 21 forks source link

Using a decimal separator other than dot may cause shipping data not to be synced #2470

Open eason9487 opened 1 month ago

eason9487 commented 1 month ago

Describe the bug:

If the decimal separator in WooCommerce core currency options is not . and shipping data is obtained from WooCommerce core, the shipping data may not be synced to Google Merchant Center.

This issue occurs in all relevant fields:

Steps to reproduce:

  1. Go to WooCommerce > Settings > General and set the decimal separator in the currency options to ,. image
  2. Go to WooCommerce > Settings > Shipping > Shipping zones and set up a zone with:
    • Free shipping and minimum order amount, e.g. 999,99 image
    • Flat rate with single cost or class costs. image
  3. Go to edit free listings.
  4. Select the Recommended: Automatically sync my store’s shipping settings to Google option for the shipping rates setting.
  5. Add the above configured zone to the Audience setting.
  6. Save changes.
  7. Wait a moment for the settings to sync to Google Merchant Center.
  8. Go to Google Merchant Center and navigate to Shipping and returns page.
  9. No shipping data has been synchronized to Shipping policies.

image

Expected behavior:

The shipping costs should be parsed according to the currency options set in the WooCommerce core and synced correctly to Google Merchant Center.

Actual behavior:

The shipping costs may not be parsed and omitted to sync to Google Merchant Center when the decimal separator in WooCommerce core currency options is not using ..

Additional details:

How WooCommerce core handles amount formatting: https://github.com/woocommerce/woocommerce/blob/9.0.2/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php#L108-L115