Skip to content Skip to sidebar

Resolved

Reported for: WPML Multilingual & Multicurrency for WooCommerce 4.12.6

Resolved in: WooCommerce Multilingual & Multicurrency 5.5.2

Overview of the issue

WPML Multilingual & Multicurrency for WooCommerce allows you now to translate and display product reviews. However, it is not possible yet to translate responses to those reviews.

Workaround

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

  1. Edit wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/FrontEndHooks.php file.
  2. Replace:
    	private static function isNonEmptyReview( $comment ) {
    		return Obj::prop( 'comment_content', $comment )
    		       && Relation::propEq( 'comment_type', self::COMMENT_TYPE, $comment );
    	}
    

    With:

    	private static function isNonEmptyReview( $comment ) {
    		return Obj::prop( 'comment_content', $comment )
    		       && Relation::propEq( 'comment_type', self::COMMENT_TYPE, $comment ) || Relation::propEq( 'comment_type', 'comment', $comment );
    	}
    
  3. Then open go to: wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/Mapper.php file.
  4. Replace:
    	private function getUnregisteredReviews() {
    		// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
    		$q = "SELECT c.comment_ID, c.comment_post_ID, c.comment_content, c.comment_type, tr.language_code, st.name, st.value
    				FROM {$this->wpdb->comments} AS c
    				LEFT JOIN {$this->wpdb->prefix}icl_translations AS tr
    					ON tr.element_id = c.comment_post_ID AND tr.element_type = 'post_product'
    				LEFT JOIN {$this->wpdb->prefix}icl_strings AS st
    					ON c.comment_content = st.value
    						AND st.context = '" . FrontEndHooks::CONTEXT . "'
    				WHERE c.comment_type = '" . FrontEndHooks::COMMENT_TYPE . "'
    					AND st.name IS null";
    
    		return (array) $this->wpdb->get_results( $q );
    	}
    

    With:

    	private function getUnregisteredReviews() {
    		// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
    		$q = "SELECT c.comment_ID, c.comment_post_ID, c.comment_content, c.comment_type, tr.language_code, st.name, st.value
    				FROM {$this->wpdb->comments} AS c
    				LEFT JOIN {$this->wpdb->prefix}icl_translations AS tr
    					ON tr.element_id = c.comment_post_ID AND tr.element_type = 'post_product'
    				LEFT JOIN {$this->wpdb->prefix}icl_strings AS st
    					ON c.comment_content = st.value
    						AND st.context = '" . FrontEndHooks::CONTEXT . "'
    				WHERE c.comment_type = '" . FrontEndHooks::COMMENT_TYPE . "' OR c.comment_type = 'comment'
    					AND st.name IS null";
    
    		return (array) $this->wpdb->get_results( $q );
    	}
    
  5. Finally, go to WooCommerce → WooCommerce MultilingualStatus and click on the Troubleshooting link.
  6. Select Register product reviews for translations.
  7. Click on the Start button.

2 Responses to “WooCommerce - Responses to reviews are not registered for translation”

    • Our developers are aware of this issue and it is in their roadmap although we don’t have an ETA.
      We will keep this page updated with any news.