WPML

ภาพรวมของปัญหา

เมื่อใช้ตัวเลือกหลายสกุลเงินจาก WPML Multilingual & Multicurrency for WooCommerce คุณอาจพบปัญหาต่อไปนี้:

หากเปิดใช้งานตัวเลือก “Show only products with custom prices in secondary currencies” สินค้าแบบมีตัวเลือกจะไม่แสดงตัวสลับสกุลเงิน แม้ว่าทุกรูปแบบจะมีการตั้งค่าราคาที่กำหนดเองในสกุลเงินรองก็ตาม

วิธีแก้ปัญหาชั่วคราว

โปรดตรวจสอบให้แน่ใจว่าคุณได้สำรองข้อมูลไซต์ทั้งหมดของคุณก่อนดำเนินการต่อ

  • เปิดไฟล์ …/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;
    	}
    }

ปัญหาที่ทราบแล้วทั้งหมด