Resolved
Reported for: WooCommerce Multilingual & Multicurrency 5.1.2
Resolved in: WCML 5.2.0
Overview of the issue
If a client places an order in a secondary language containing a WooCommerce variable product, the original product ID and the ID of the translated variable product display on the order. Instead, it should only display the original product IDs.
Workaround
Please, make a full backup of your site before proceeding.
- Open …/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-orders.php file.
- Look for line 191.
- Replace:
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; }
With:
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; }