탐색 건너뛰기

Open

Reported for: WooCommerce Multilingual & Multicurrency 5.3.2

Topic Tags: Compatibility, WCML

Overview of the issue

In WooCommerce Subscriptions, when updating a subscription (whether it’s an upgrade, downgrade, or crossgrade), the price isn’t filtered correctly. This results in incorrect pricing during the change of subscription plans.

Workaround

Please, make sure of having a full backup of your site before proceeding.

  • Open …/wp-content/plugins/woocommerce-multilingual/compatibility/WcSubscriptions/MulticurrencyHooks.php file.
  • Look for line 253.
  • Change:
    	public function woocommerce_subscription_price_from( $price, $product ) {
    		if ( $product instanceof WC_Product_Subscription_Variation ) {
    			$customPricesOn = get_post_meta( $product->get_id(), '_wcml_custom_prices_status', true );
    
    			if ( $customPricesOn ) {
    				$price = get_post_meta( $product->get_id(), '_price_' . $this->woocommerce_wpml->multi_currency->get_client_currency(), true );
    			} else {
    				$price = apply_filters( 'wcml_raw_price_amount', $price );
    			}
    		}
    
    		return $price;
    	}
    
  • For:
    	public function woocommerce_subscription_price_from( $price, $product ) {
    		if ( $product instanceof WC_Product_Subscription_Variation || $product instanceof \WC_Product_Subscription) {
    			$customPricesOn = get_post_meta( $product->get_id(), '_wcml_custom_prices_status', true );
    
    			if ( $customPricesOn ) {
    				$price = get_post_meta( $product->get_id(), '_price_' . $this->woocommerce_wpml->multi_currency->get_client_currency(), true );
    			} else {
                    $id = $product->get_id();
                    $type = get_post_type($id);
    				$trid = apply_filters( 'wpml_element_trid', NULL, $id,  'post_'.$type );
    				$translations = apply_filters( 'wpml_get_element_translations', NULL, $trid , 'post_'.$type );
                    foreach ($translations as $translation){
                        if ($translation->original == 1){
                            if ( get_post_meta( $translation->element_id, '_wcml_custom_prices_status', true ) ) {
    	                        $price = get_post_meta( $translation->element_id, '_price_' . $this->woocommerce_wpml->multi_currency->get_client_currency(), true );
                            } else {
    	                        $price = apply_filters( 'wcml_raw_price_amount', $price );
                            }
                        }
                    }
                }
    		}
    
    		return (int)$price;
    	}
    

4 응답 - “WooCommerce Subscriptions - Incorrect Price Filtering on Upgrade/Downgrade”

  1. This fix looks like it tackles only the “From” price, which is just graphics/information and does not fix the issue in the cart.

    Originally, I reported these two issues, and your team decided to create two different tickets.

    So, you started to solve the first part of the ticket here: Link to Ticket 1

    While working on the second part of the split ticket here: Link to Ticket 2.

    It looks like splitting the original ticket created a bit of redundancy for your support, as you also saw issue one while trying to fix issue two. Perhaps you should assign one person to address both issues.

    Thanks for the effort to resolve the issue

  2. I have the same problem, it doesn’t change the price in subscription products, it only changes the currency. How can I solve it?

답장을 남겨주세요

주제를 유지하고 다른 사람을 존중하십시오. 이 게시물과 관련 없는 문제에 대한 도움이 필요한 경우 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하십시오.

다음 태그를 사용할 수 있습니다.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>