Skip Navigation

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 25 replies, has 2 voices.

Last updated by Yvette 1 month, 3 weeks ago.

Assigned support staff: Yvette.

Author Posts
March 11, 2021 at 4:54 pm #8288137

Giancarlo

Hi,
I have WPML in 4 languages. Products exist only in the main one (DE) and WPML is set to “use translation if available or fallback to default language”.

In the translated website, the filters work fine if applied to a category page, but not on the mainproduct archive page /shop – either when it is set through woocommerce settings or through shortcode

What can be the problem?
Is there a way to filter products when the "fallback" option is set?

Examples from the staging URL:

This works:
hidden link

This doesn’t:
hidden link

March 12, 2021 at 10:00 am #8292153

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Rome (GMT+02:00)

Hello

I will be helping you.

It would depend on the widget/filter. The standard Woocommerce filters by price seem to work, for example.

But the standard "attribute " filter from Woocommerce does not.

The short answer is that it depends on how the query of the widget is coded. In the case of taxonomies, the query will be looking for any products that are assigned to the translated term. And it will not find any.

If, however, you have set the taxonomy to "appear as translated" as well, then the ones tags that will show in the filter will be the default language tags since there are real products assigned to it.

You can see this here on this sandbox site
hidden link

Spanish is the 2nd languages. All products exist only in English. Only the taxonomy term: Small remains untranslated....so it is visible on the Spanish shop.

The other taxonomy terms: Large, Medium
have been translated to "Grande" "Mediano" and consequently will not appear in the Spanish shop as filters because there are not spanish products assigned to those terms.

March 12, 2021 at 10:13 am #8292239

Giancarlo

Hello Yvette, thanks for your reply.
I am not able to open your sandbox link due to a privacy restriction

To have untranslated taxonomies would mean to have quite a mess with the product variations, since they are created with the mix of these taxonomies.. so I don't think it's an option

But why do ajax filters work in category pages? The problem happens only in the main Shop page and this makes me crazy..

March 12, 2021 at 11:20 am #8293211

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Rome (GMT+02:00)

Here´s the link to login:
hidden link

Please see if you can repliate the issue there and we can then send the questions on to development if needed.

March 15, 2021 at 8:40 am #8308457

Giancarlo

Hello Yvette,
please don't close the thread, since I am still trying to open your URL, which is blocked by our IT structure because it is shown as not secure.

March 15, 2021 at 9:36 am #8308977

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Rome (GMT+02:00)

OK - no issues. If you need another sandbox for any reason, please just advise and I will provide another one for you.

March 16, 2021 at 8:21 am #8317759

Giancarlo

Hi Yvette,
in the sandbox the problem is not appearing, I can filter products from the Spanish shop / main page even if they phisically exist only in English..

hidden link

March 16, 2021 at 8:54 am #8318225

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Rome (GMT+02:00)

OK. Then the next step in our troubleshooting is to do the following on your site:

1. Setup the configuration of theme and plugins to be the same as our sandbox. With this setup, is the filtering working as it does in our sandbox?

2. If it DOES NOT and all the versions of the plugins and theme are the same, then please send us a copy of your site as per this article:
https://wpml.org/faq/provide-supporters-copy-site/

Use a filesharing service like WeTransfer to send us the files. Do not attempt to uplaod the package directly to the forum and include the downloadable link in your next reply.

3. OTHERWISE, begin to restore your normal system configuration step by step...starting with your theme and test the product filtering each time after each step until you find the plugin/theme activation that causes the filtering to stop working. Write back with the name of that plugin/theme.

Thanks

March 16, 2021 at 10:15 am #8318855

Giancarlo

Actually I realized that the filter works only if the taxonomy is set on "not translatable" (as the attribute color, in the sandbox).

If the taxonomy that is set on "Translatable - use translation if available or fallback to default language" (as the attribute Size) then it won't work.

See here: hidden link

What is the correct way to set up products, products tags, product categories and attributes?
I really don't understand why all this problem happens only in the /shop page and not in the category pages..

March 16, 2021 at 3:58 pm #8323657

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Rome (GMT+02:00)

I believe this problem was reported and escalated already to our development team. A possible workaround has been suggested here:
https://wpml.org/forums/topic/shopping-page-content-not-synchronized-between-languages/#post-8323597

Could you please try it out and let me know if it helps you?

The reason why it works on the category archive pages and not on the shop pages has to do with a problem with our coding. A method is hooked onto get_term hook and probably should not be run for "Display as translated" taxonomies.

March 16, 2021 at 4:04 pm #8323877

Giancarlo

Hello,
I added your code on functions.php, but still no success. I attach the screenshot from the filters widget in the admin bar, if it helps

hidden link

Screenshot 2021-03-16 170354.jpg
March 17, 2021 at 8:46 am #8328911

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Rome (GMT+02:00)

Alright - I see in the internal notes that it was suggested as a possible workaround but not guaranteed. I will give feedback to 2nd tier.

However - can I get your confirmation that the problem is the same as what is described in the other ticket?

March 17, 2021 at 10:05 am #8330089

Giancarlo

No, my problem is that in the main /shop page (the translated ones) the ajax filters don't find any product.

They work if I am in a category page though

This doesn't work
hidden link

This works
hidden link

March 17, 2021 at 11:17 am #8331043

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Rome (GMT+02:00)

Alright - then we need to go back to the normal troublshooting steps. I had previously asked you to test the behaviour by deactivating all non-WPML plugins except for Woocommerce and to also change your theme to Storefront trempoarily.

What was the result of this action?

And please reread the message to know what we now need to do:
https://wpml.org/forums/topic/ajax-filters-not-working-in-shop-where-fallback-products-are-shown/#post-8318225

March 18, 2021 at 8:57 am #8339451

Giancarlo

Hi,
yes I did it, but I couldn't spot the problem.

It must be related to how the WPML logic works when the "fallback products" are shown in an archive page, since the problem appears only in /shop, and not in the categories or tag pages.