Skip to content Skip to sidebar

Resolved

Reported for: WPML Multilingual & Multicurrency for WooCommerce 5.5.2.1

Resolved in: WooCommerce Multilingual & Multicurrency 5.5.2.2

Topic Tags: WCML

Overview of the issue

In WPML Multilingual & Multicurrency for WooCommerce, it may occur that when translating a variable product, the default variation in the second language is either missing or incorrectly set to 0.
This happens when the term_id and term_taxonomy_id values differ, which can occur with global product attributes.

Workaround

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

  • Open …/woocommerce-multilingual/classes/Synchronization/Component/Attributes.php file.
  • Look for line 137.
  • Replace:
    $defaultTermIdTranslations = $this->elementTranslations->get_element_translations( $defaultTermId, false, true );
    
  • With:
    $defaultTermIdTranslations = [];
    
  • On the same file, look for line 149 and replace:
    $translatedDefaultTermId = $this->elementTranslations->element_id_in( $defaultTermId, $language );
    
  • With:
    $translatedDefaultTermId = apply_filters( 'wpml_object_id', $defaultTermId, $sanitizedAttributeName, false, $language );
    
  • After applying these changes, you need to manually save or update the products with this issue.