Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are encountering a critical error when using WooCommerce Product Filters in a secondary language.
Solution:
We recommend setting up independent filters for each language:
1. Navigate to WooCommerce > Filters.
2. Switch to the second language and create a new filter directly in that language, then save it.
3. Obtain the shortcode for this new filter (e.g.,

[wcpf_filters id="86"]

).
4. Go to Appearance > Widgets, add a shortcode block, and insert the shortcode for the new filter.
5. Translate the necessary strings in WPML > String Translator, specifically the admin_texts_wcpf_setting_default_project string with the ID of the new filter.

This approach is necessary because the WooCommerce Product Filters plugin expects users to translate the filter ID option, as indicated in their WPML compatibility class. However, it's unclear if this is the recommended workflow or if translated filters should also function correctly. We suggest contacting the Product Filters for WooCommerce plugin authors to report this issue, as the plugin is not listed as compatible and the authors have been difficult to contact directly in the past.

Using different filters per language should serve as an alternate solution until further clarification is obtained.

If this solution does not resolve your issue or seems irrelevant due to updates or differences in your case, please open a new support ticket. 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. For further assistance, you can also visit our support forum at WPML Support Forum.

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.

Tagged: 

This topic contains 24 replies, has 2 voices.

Last updated by Lauren 6 months, 3 weeks ago.

Assisted by: Lauren.

Author Posts
April 15, 2024 at 1:46 pm #15520484

elinaB-3

Critical error in second language with WooCommerce Product Filters

April 15, 2024 at 3:35 pm #15521186

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

This ticket has been escalated to our compatabilitly team and I will update here once I have more information.

April 15, 2024 at 3:35 pm #15521203

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

This ticket has been escalated to our compatabilitly team and I will update here once I have more information.

April 16, 2024 at 6:14 am #15522365

elinaB-3

hello, any followup ?

April 16, 2024 at 1:22 pm #15525659

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

This has been escalated to our compatibiltiy team and I will update here as soon as I have more information. They will need time to investigate the issue, and perhaps contact the plugin author if they need to work together for a resolution.

April 22, 2024 at 12:30 pm #15550284

elinaB-3

any followup ?

April 22, 2024 at 2:12 pm #15551128

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Our team has looked into this, and it seems that perhaps the issue is coming form manual translation. It appears to work okay with the WPML translation editor. Is there a reason you need to translate this manually? Perhaps if you can explain the end result, I can find a solution. If you are needing to translate the filter strings, it may be possible to set the filter as "not translatable" and then translate the strings using string translation. I haven't tested this yet, as I would like to know what the goal is on your site so we can figure out an approriate solution.

In the meantime, our tean has found a solution to remove the warning, but this is not really a solution, as mentioned previously we need to determine what exactly you are trying to translate manually.

Important:this is just a "hack" to prevent the warning/error to be displayed, and not a proper fix for the issue.

Open the app/public/wp-content/plugins/woocommerce-product-filters/includes/plugin-support/class-wpml.php file
Around line 159, replace the following snippet:

$entry = $this->get_entity_register()->get_entry( $entity->get_entity_key() );

With:

$entry = $this->get_entity_register()->get_entry( $entity->get_entity_key() );

if ( is_null($entry) ) {
	return '';
}

Please share as much information with me as you can so I can move forward in the correct direction. Thank you.

April 23, 2024 at 7:32 am #15553928

elinaB-3

i need to translate filter labels etc here

and i dont have line 159 here.wp-content/plugins/woocommerce-product-filters/includes/plugin-support/class-wpml.php

my file has only 64 lines 🙁

filters.png
April 23, 2024 at 7:45 am #15554090

elinaB-3

so i fixed the file (it was different file)

but now it still would not translate the inner elements. when i open translatons, i need to recreate filter elements. maybe this is how it is

April 23, 2024 at 7:48 am #15554094

elinaB-3

also add element does not work in translated version

April 23, 2024 at 1:11 pm #15556194

elinaB-3

and there is no filter here hidden link

April 23, 2024 at 2:25 pm #15556780

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Did you try translating the filter labels using String Translation? Please test with both filters set as Translatable as well as Filters set as Not Translatable. You can change this settings in WPML -> Settings in the post type section. Also, you can use the search at the top of the string translation to search for the filter labels.

Please let me know the results of this test.

April 24, 2024 at 5:55 am #15558678

elinaB-3

i now use

use translation if available or fallback to default language

for filters and items

April 24, 2024 at 6:00 am #15558680

elinaB-3

can you share sandbox again ?

April 24, 2024 at 1:34 pm #15561007

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

The previous sandbox site expired, so I have created a new one:
hidden link

Please add the plugin here and create a filter similar to the one on your site so that I can login in at this test site and try to translate the filters using string translation.

Let me know once it is ready for me to test further.