- ステータス
- 解決済み
- 報告対象
- WPML Multilingual & Multicurrency for WooCommerce 5.5.0
- 解決されたバージョン
- WPML Multilingual & Multicurrency for WooCommerce 5.5.3
問題の概要
WPML Multilingual & Multicurrency for WooCommerceのマルチ通貨オプションを使用している場合、以下の問題が発生することがあります。
「Show only products with custom prices in secondary currencies」オプションが有効になっている場合、すべてのバリエーションに第2通貨のカスタム価格が設定されている場合でも、バリエーション商品に通貨切り替えが表示されません。
回避策
続行する前に、サイトの完全なバックアップを取得してください。
- …/wp-content/plugins/woocommerce-multilingual/inc/currencies/currency-switcher/class-wcml-currency-switcher.phpファイルを開きます。
- 353行目を探します。
- 次のコードを:
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; } } - 以下に置き換えます:
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; } }