- الحالة
- محلولة
- تم حلها في
- 4.12.0
- الإضافة/القالب ذو الصلة
- WooCommerce Dynamic 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 ) ); }