WPML

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

ใน SMS Alert Order Notifications – WooCommerce ลูกค้าที่สั่งซื้อในภาษารองจะได้รับ SMS คำสั่งซื้อเป็นภาษาเริ่มต้นของไซต์ของคุณ

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

จนกว่า SMS Alert จะแก้ไขปัญหานี้ คุณสามารถส่ง SMS คำสั่งซื้อในภาษาของคำสั่งซื้อได้:

  1. ไปที่ WPMLการตั้งค่า เปิด การกำหนดค่า XML ที่กำหนดเอง เพิ่มโค้ดนี้แล้วบันทึก:
    <wpml-config>
      <admin-texts>
        <key name="smsalert_message">
          <key name="sms_body_*" />
        </key>
      </admin-texts>
    </wpml-config>
  2. ไปที่ WPMLการแปลสตริง และแปลเทมเพลต SMS (โดเมน admin_texts_smsalert_message)
  3. เพิ่มโค้ดนี้ลงในไฟล์ functions.php ของธีมของคุณ หรือเพิ่มด้วยปลั๊กอิน Code Snippets โค้ดนี้จะสร้าง SMS สำหรับลูกค้าในภาษาของคำสั่งซื้อ:
    add_action( 'woocommerce_order_status_changed', function ( $order_id ) {
    	$order = wc_get_order( $order_id );
    	$lang  = $order ? $order->get_meta( 'wpml_language' ) : '';
    	if ( $lang ) {
    		$GLOBALS['sms_alert_wpml_previous_lang'] = apply_filters( 'wpml_current_language', null );
    		do_action( 'wpml_switch_language', $lang );
    	}
    }, 9 );
    
    add_action( 'woocommerce_order_status_changed', function () {
    	if ( isset( $GLOBALS['sms_alert_wpml_previous_lang'] ) ) {
    		do_action( 'wpml_switch_language', $GLOBALS['sms_alert_wpml_previous_lang'] );
    		unset( $GLOBALS['sms_alert_wpml_previous_lang'] );
    	}
    }, 11 );

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

ต้องการความช่วยเหลือเกี่ยวกับปัญหานี้หรือไม่

ถามคำถามถึงฝ่ายสนับสนุน และเราจะตรวจสอบเรื่องนี้ไปพร้อมกับคุณ