Overview of the Issue
WooCommerce provides you a Filter by price widget that allows your users to easily filter your products.
Currently, if you are using our multicurrency feature, you will notice that in secondary currencies, the min and max values display correctly, however, the filter uses the prices from the default language. This causes it to display the wrong results.
Workaround
This issue is fixed. Updating to the latest version solves it on your site, so you only need this workaround if you can’t update yet.
Before proceeding, make a full backup of your site. Then:
- Open your WooCommerce Multilingual folder.
- Find /woocommerce-multilingual/inc/currencies/class-wcml-multi-currency-prices.php file.
- Go to line 620.
- Change:
$args['where'] = str_replace( $wpdb->prepare( 'wc_product_meta_lookup.min_price >= %f', $min_price ), $wpdb->prepare( 'wc_product_meta_lookup.min_price >= %f', $min_price_in_default_currency ), $args['where'] ); $args['where'] = str_replace( $wpdb->prepare( 'wc_product_meta_lookup.max_price <= %f', $max_price ), $wpdb->prepare( 'wc_product_meta_lookup.max_price <= %f', $max_price_in_default_currency ), $args['where'] );
With:
$args['where'] = str_replace( $wpdb->prepare( '%f<wc_product_meta_lookup.min_price', $max_price ), $wpdb->prepare( '%f<wc_product_meta_lookup.min_price', $max_price_in_default_currency ), $args['where'] ); $args['where'] = str_replace( $wpdb->prepare( '%f>wc_product_meta_lookup.max_price', $min_price ), $wpdb->prepare( '%f>wc_product_meta_lookup.max_price', $min_price_in_default_currency ), $args['where'] );