WPML
Trạng thái
Đã giải quyết
Được báo cáo cho
WPML Multilingual & Multicurrency for WooCommerce 5.1.2
Đã giải quyết trong
WCML 5.2.0
Thẻ chủ đề
Bug

Tổng quan về lỗi

Nếu khách hàng đặt một đơn hàng có chứa sản phẩm có biến thể WooCommerce bằng ngôn ngữ phụ, ID sản phẩm gốc và ID của sản phẩm có biến thể đã được dịch sẽ hiển thị trên đơn hàng. Thay vào đó, nó chỉ nên hiển thị các ID sản phẩm gốc.

Giải pháp tạm thời

Sao lưu toàn bộ trang web của bạn trước khi tiếp tục.


  1. Mở tệp …/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-orders.php.

  2. Tìm dòng 191.

  3. Thay thế:
    	private function adjust_product_item_if_translated( $item, $language_to_filter ) {
    
    		$product_id            = $item->get_product_id();
    		$translated_product_id = apply_filters( 'translate_object_id', $product_id, 'product', true, $language_to_filter );
    		if ( $product_id && $product_id !== $translated_product_id ) {
    			$item->set_product_id( $translated_product_id );
    			$item->set_name( get_post( $translated_product_id )->post_title );
    			return true;
    		}
    
    		return false;
    	}
    Bằng:
    	private function adjust_product_item_if_translated( $item, $language_to_filter ) {
    
    		$product_id            = $item->get_product_id();
    		$translated_product_id = apply_filters( 'translate_object_id', $product_id, 'product', true, $language_to_filter );
            $variation_id           = $item->get_variation_id();
            $translated_variation_id = apply_filters( 'translate_object_id', $variation_id, 'product_variation', true, $language_to_filter );
    		if ( $product_id && $product_id !== $translated_product_id ) {
    			$item->set_product_id( $translated_product_id );
    			$item->set_name( get_post( $translated_product_id )->post_title );
    			//return true;
    		}
            if ( $variation_id && $variation_id !== $translated_variation_id ) {
                $item->set_variation_id( $translated_variation_id );
                $item->set_name( get_post( $translated_variation_id )->post_title );
                //	return true;
            }
    
    		return true;
    	}

Tất cả các lỗi đã ghi nhận →