WPML
Status
Open
Reported for
WPML Multilingual & Multicurrency for WooCommerce 5.3.9
Topic tags
Bug, WCML

Overview of the issue

WPML Multilingual & Multicurrency for WooCommerce correctly translates product reviews when displayed under the Reviews tab on single product pages. However, when using WooCommerce’s Reviews blocks, translated reviews are not shown. Instead, the original-language reviews are displayed.

Workaround

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


  • Open your theme’s functions.php file.

  • Add the following snippet:
    add_filter( 'get_comment', 'translate_comment' );
    function translate_comment( $comment ){
    
        if ( !is_singular('product') && isset( $comment->comment_type ) && $comment->comment_type === 'review' && isset( $comment->comment_content ) ) {
            $name = 'product-'.$comment->comment_post_ID.'-review-'.$comment->comment_ID;
            $comment->comment_content = apply_filters( 'wpml_translate_single_string', $comment->comment_content, 'wcml-reviews', $name );
        }
        
        return $comment;
    }

All known issues →