WPML
add_action( 'wcml_before_sync_product_data', 'the_callback_function', 10, 3 );
ประเภท
action
เวอร์ชันของ WooCommerce Multilingual
3.7.0

คำอธิบาย

  • เรียกใช้การดำเนินการก่อนที่ WCML จะซิงค์ข้อมูล (รูปภาพ อนุกรมวิธาน รูปแบบสินค้า ฯลฯ) จากสินค้าต้นฉบับไปยังการแปล
  • การดำเนินการนี้จะถูกเรียกใช้หลังจาก wcml_before_sync_product

อาร์กิวเมนต์

มีพารามิเตอร์ 3 ตัวที่ถูกส่งไปยังการดำเนินการนี้:
$original_product_id
(integer) ID ของสินค้าต้นฉบับ
$translated_product_id
(integer) ID ของสินค้าที่แปล
$target_language
(string) รหัสภาษาของสินค้าที่แปล

ตัวอย่างการใช้งาน

ตัวอย่าง
add_action( 'wcml_before_sync_product_data', 'my_custom_action', 10, 3 );

function my_custom_action( $original_product_id, $translated_product_id, $target_language ) {

	// my custom action

}

wcml_after_duplicate_product_post_meta, wcml_update_extra_fields, wcml_js_lock_fields_ids, wcml_js_lock_fields_input_names, wcml_js_lock_fields_classes, wcml_before_sync_product

ฮุก การอัปเดตเนื้อหา ทั้งหมด 7 รายการ →