This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues with manually translated product attributes adding an extra slug in the URL, which causes filters in other languages to not work correctly, especially when using the Kadence theme with WooCommerce and the Query Loop, this summary might help.
Solution:
We recommend modifying the code in your Kadence Blocks Pro plugin to handle the attribute translations more effectively. Here are the steps:
1. Open the file
/wp-content/plugins/kadence-blocks-pro/includes/query/query-indexer-woo.php
.
2. Locate line 74.
3. Replace the
Replace:
if ( ! empty( $attribute_values ) ) { $attribute_values_array = explode( ',', $attribute_values ); foreach ( $attribute_values_array as $facet_name ) { $facet_name = trim( $facet_name ); $term = get_term_by('name', $facet_name, $tax_name); if ($term) { $term_id = $term->term_id; } $rows[] = array( 'facet_value' => isset( $term_id ) ? $term_id : 0, 'facet_name' => $facet_name, 'facet_id' => isset( $term_id ) ? $term_id : 0 ); } return $rows; }
With:
if ( ! empty( $attribute_values ) ) { $attribute_values_array = explode( ',', $attribute_values ); foreach ( $attribute_values_array as $facet_name ) { $facet_name = trim( $facet_name ); $term = get_term_by('name', $facet_name, $tax_name); if ($term) { $term_id = $term->term_id; } //WPML workaround for compsupp-7812 $languages = apply_filters( 'wpml_active_languages', NULL); if ( !empty( $languages ) ) { foreach( $languages as $language ){ $term_id = apply_filters( 'wpml_object_id', $term_id, $tax_name, TRUE, $language['language_code'] ); $rows[] = array( 'facet_value' => isset( $term_id ) ? $term_id : 0, 'facet_name' => $facet_name, 'facet_id' => isset( $term_id ) ? $term_id : 0 ); } } } return $rows; }
4. After making these changes, go to your default language product and click update to create a re-index for the loop.
Please note that this solution might become outdated or may not apply to your specific case. If this solution does not resolve your issue, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 18 replies, has 0 voices.
Last updated by 2 days, 11 hours ago.
Assisted by: Dražen.