- Status
- Resolved
- Reported for
- WPML Multilingual & Multicurrency for WooCommerce 5.5.0
- Resolved in
- WPML Multilingual & Multicurrency for WooCommerce 5.5.3
Overview of the issue
When using the multicurrency option from WPML Multilingual & Multicurrency for WooCommerce, you might experience the following issue:
If the option “Show only products with custom prices in secondary currencies” is enabled, variable products do not display the currency switcher, even when all variations have custom prices set in the secondary currency.
Workaround
Please, make sure of having a full site backup of your site before proceeding.
- Open the …/wp-content/plugins/woocommerce-multilingual/inc/currencies/currency-switcher/class-wcml-currency-switcher.php file.
- Look for line 353.
- Replace:
if ( $product && $product->is_type( 'grouped' ) ) { foreach ( $product->get_children() as $child_id ) { if ( ! $hasOriginalCustomPrices( $child_id ) ) { return false; } } } else { if ( ! $hasOriginalCustomPrices( $currentProductId ) ) { return false; } } - With:
if ( $product && $product->is_type( 'grouped' ) || $product->is_type( 'variable' ) ) { foreach ( $product->get_children() as $child_id ) { if ( ! $hasOriginalCustomPrices( $child_id ) ) { return false; } } } else { if ( ! $hasOriginalCustomPrices( $currentProductId ) ) { return false; } }