Skip Navigation

Open

Reported for: WooCommerce Multilingual & Multicurrency 5.3.9

Topic Tags: Bug, WCML

Overview of the issue

WooCommerce Multilingual 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;
    }
    

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>