google-listings-and-ads icon indicating copy to clipboard operation
google-listings-and-ads copied to clipboard

The shipping rate currency synced to Google Merchant Center doesn't use the display currency but the current store currency when using the simple settings

Open eason9487 opened this issue 1 year ago • 1 comments

Describe the bug:

The shipping rate currency synced to Google Merchant Center may not use the same currency shown on the UI of Free Listings setting.

https://github.com/woocommerce/google-listings-and-ads/assets/17420811/47658485-3f10-40fb-90a4-6a7fe5731a60

Steps to reproduce:

  1. On the WooCommerce > Settings > General page, set the store currency to Japanese yen (¥).
  2. Go to GLA's Edit free listings page.
  3. Select the "My shipping settings are simple. I can manually estimate flat shipping rates" option.
  4. Set shipping rates to 1000.
  5. Save changes.
  6. Set the store currency to United States (US) dollar ($).
  7. Back to the Edit free listings page, change the shipping rates to 1500, and save changes again.
  8. Open the admin page of the connected Google Merchant Center.
  9. Click the setting icon on the top-right side and select "Shipping and returns".
  10. Check the shipping services. The shipping costs are incorrectly set to 1500 USD.

Expected behavior:

With the simple settings, the currency of the synced shipping rates should be the same as the ones shown on the GLA UI.

Actual behavior:

With the simple settings, the currency of the synced shipping rates incorrectly uses the current store currency.

eason9487 avatar Jan 22 '24 11:01 eason9487

Nice find, definitely some inconsistent behaviour there. I have the feeling we can set this to low priority though. From what I can see, is if in between steps 6 and 7 there would be a page refresh (which would happen if they didn't have each open in a separate tab), the newly set currency would load on the edit settings page.

Either way though it happens mainly because the code which fetches the rates from the DB will use the store currency and not the currency saved with the rate in the DB. See here the code which sets the store currency for the whole class: https://github.com/woocommerce/google-listings-and-ads/blob/2.5.15/src/API/Google/Settings.php#L111 And when we through the rates we get the currency from the class instead of each individual rate: https://github.com/woocommerce/google-listings-and-ads/blob/2.5.15/src/Shipping/GoogleAdapter/DBShippingSettingsAdapter.php#L73

If the intention of that class is to sync the rates from the DB > Google, then I think we should submit the currency in the rate row and not override it with the store currency.

mikkamp avatar Jan 22 '24 13:01 mikkamp