WPML
상태
해결됨
해결된 버전
4.12.0
관련 플러그인/테마
WooCommerce Dynamic 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 ) );
    	}

알려진 모든 문제 →