Multicurrency - Filter by Price block doesn't convert the prices #6024
Description
Describe the bug
When the user is switched to the geolocation currency (once the option for an auto switch is enabled), the Filter by Price still displays the values in default store currency.
To Reproduce
- Make sure to have plugins: WC Payments, WC Blocks installed
- In WC Payments settings enable currency switch based on geolocation
- Change the default store currency to different one than your local currency
- Create a new post
- Add Filter by Price and Products blocks
- Save and go to frontend
- Add a product to the cart
- Refresh the page
Actual behavior
While all the products display the prices in your local currency and prices are converted, Filter by Price displays the correct currency, but value is not converted and still in store default currency.
Expected behavior
Filter by Price should display min and max price converted to the geolocated currency.
Example:
In this example: USD to PLN exchange is ~4.5. The max price of the store is 60 USD, so after conversion to PLN:
Expected: In PLN it should be 60 * 4.5 = 290 zł
Actual: Filter by Price still displays 60 zł (red rectangle)
Keep in mind there are two problems:
- Currency will be picked up once the user session is established. That can be mimicked by adding a product to the store (allowing the filter to pick up the currency without the session is covered in this issue: Multicurrency - Geolocation users do not see Product Filter block picking up switched currency #5996)
- The scope of this particular issue: value is not converted even though
Additional context
POC
This issue involves WC Payments and WC Blocks. Here's a POC showcasing a possible solution:
-
On WCPay we should add a dedicated class in compatibility layer: [POC] Add a Multi Currency comaptibility layer for WooCommerce Blocks #5984
-
On WCBlocks we have to add the new filters: [WIP] Add filters to add compatibility with WC Payments plugin woocommerce/woocommerce-blocks#8977
-
Corresponding WCBlocks issue: Multicurrency - Filter by Price block doesn't convert the prices woocommerce/woocommerce#42407
Ref
More details available in per0F9-yg-p2