- สถานะ
- แก้ไขแล้ว
- แก้ไขใน
- 4.12.0
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- WooCommerce Dynamic Pricing
ภาพรวมของปัญหา
เมื่อใช้ฟีเจอร์ Advanced Category Pricing จากปลั๊กอิน WooCommerce Dynamic Pricing ส่วนลดจะไม่ถูกนำมาใช้กับสินค้าที่มีหลายรูปแบบ (ใช้กับสินค้าทั่วไปเท่านั้น)
วิธีแก้ปัญหาชั่วคราว
เรามีวิธีแก้ไขปัญหาอย่างถาวรแล้ว ซึ่งกำลังรอการทดสอบอย่างเต็มรูปแบบและการเผยแพร่ ในระหว่างนี้ คุณสามารถใช้วิธีแก้ปัญหาชั่วคราวต่อไปนี้เพื่อแก้ไขปัญหาบนเว็บไซต์ของคุณ:
- สำรองข้อมูลไซต์ของคุณอย่างครบถ้วนก่อนดำเนินการต่อ
- เปิด wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-dynamic-pricing.php และค้นหาบรรทัดที่ 118
- แทนที่ส่วนนี้:
public function woocommerce_dynamic_pricing_is_applied_to( $process_discounts, WC_Product $_product, $module_id, $dynamic_pricing, $cat_ids ) { if ( ! $_product || ! $cat_ids || ! $this->has_requirements( $dynamic_pricing ) ) { return $process_discounts; } $taxonomy = $this->get_taxonomy( $dynamic_pricing ); $product_id = apply_filters( 'wpml_object_id', $_product->get_id(), 'product', true ); return is_object_in_term( $product_id, $taxonomy, $this->adjust_cat_ids( $cat_ids, $taxonomy ) ); }ด้วย
public function woocommerce_dynamic_pricing_is_applied_to( $process_discounts, WC_Product $_product, $module_id, $dynamic_pricing, $cat_ids ) { if ( ! $_product || ! $cat_ids || ! $this->has_requirements( $dynamic_pricing ) ) { return $process_discounts; } $taxonomy = $this->get_taxonomy( $dynamic_pricing ); $product_id = apply_filters( 'wpml_object_id', $_product->get_id(), 'product', true ); //fix for variable products if ($_product->post_type === "product_variation") { $product_id = wc_get_product( $_product->get_parent_id() )->get_id(); $product_id = apply_filters( 'wpml_object_id', $product_id, 'product', true ); return is_object_in_term( $product_id, $taxonomy, $this->adjust_cat_ids( $cat_ids, $taxonomy ) ); } return is_object_in_term( $product_id, $taxonomy, $this->adjust_cat_ids( $cat_ids, $taxonomy ) ); }