WPML
סטטוס
נפתר
נפתר בגרסה
4.12.0
תוסף/ערכת עיצוב קשורים
WooCommerce Dynamic Pricing

סקירה כללית של התקלה

בעת שימוש בתכונה Advanced Category Pricing מהתוסף WooCommerce Dynamic Pricing, ההנחות לא מוחלות על מוצרים משתנים (רק על מוצרים פשוטים).

פתרון עוקף

יש לנו כבר תיקון קבוע לבעיה הממתין לבדיקה מלאה ולשחרור גרסה. בינתיים, תוכל להשתמש בפתרון העוקף הבא כדי לתקן את הבעיה באתר שלך:


  1. בצע גיבוי מלא של האתר שלך לפני שתמשיך.

  2. פתח את wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-dynamic-pricing.php ומצא את שורה 118.

  3. החלף את זה:
    	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 ) );
    	}

כל התקלות הידועות →