Skip Navigation

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

Problem:
In a WooCommerce shop with multiple languages, the 'product-category' slug was translated for different languages. However, for the German language, setting the slug to 'produkte' results in a 404 error when visiting the page. The backend shows the Dutch translation instead.

Solution:
We analyzed the issue and determined it is not directly related to WPML or WooCommerce, but rather to the permalink structure used. WordPress uses specific rules to determine what content to display based on the URL visited. If both single products and product categories share a similar permalink base (e.g., site.com/products/), WordPress may struggle to differentiate between product requests and product category archive requests, leading to errors like the one experienced. We recommend changing the permalink structure so that products and product categories do not use the same base. For example, use 'products' for the product category base and '/product/%product_cat%/' for the custom product base. This adjustment should resolve the issue.

If this solution does not apply to your case, or if it seems outdated, 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 at WPML support forum for further assistance.

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 34 replies, has 3 voices.

Last updated by T4ng 3 months, 2 weeks ago.

Assisted by: Waqas Bin Hasan.

Author Posts
July 9, 2024 at 7:07 am #15918312

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

And yes, your staging site is still needed, please keep the access open, thanks.

July 12, 2024 at 4:38 am #15939550

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

Our team has investigated in detail:

...the problem arises because of the particular permalink settings they have chosen, or the combination of settings for products and product categories.

They changed the product category base to "products".

And they changed the product base to "products/%product_cat%".

On local copy after updating the product base to "product" and re-translating to the other languages, the product category archive URLs now appear to function correctly.

and suggests the following:

Can you confirm with them, and check if that is an acceptable solution?

(We can try looking further into the specific combination they used and why it broke, but that would inevitably take time before an update could possibly resolve that.)

Please let me know.

July 17, 2024 at 8:41 am #15964817

Ton

Hi Waqas,

This solution is not acceptable, the slugs can be translated so without the "s" would not be any different than with the "s".

Also the customer wants it the way it is, that's why we have created it like this.
It is a translatable field, therefore i would like a permanent solution that works with the settings like we have. it is a core function of WPML so it must work.

i know it may take a little more time but expect a solution soon.

July 17, 2024 at 9:57 am #15965415

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates. I've updated our team about it and 'll get back to you accordingly.

Thanks again for your patience and coopertaion.

August 6, 2024 at 5:44 am #16042456

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

Our team did a very detailed analysis and have finalized it as a not WPML or WooCommerce problem. I'll copy their report below for better understanding:

[We recommend that client] ...really should rethink their permalink structure.

WordPress has rules it uses to determine what is intended to be shown when a particular URL is visited.

If both single products and product categories have a permalink structure that begins with site.com/products/ then it makes it difficult for WordPress to distinguish between requests for products and requests for product category archives, and it can lead to mistakes, which is what the client is experiencing.

I made a demo of the problem on a sandbox site. Without WPML, I setup a WooCommerce site and I imported the sample products that ship with the plugin.

The only change I made to the site was to edit the permalinks to match those chosen by the client, i.e. products for the product category base and /products/%product_cat%/ for the product base.

Visit a product link, e.g. hidden link (note how it conforms to the expected permalink structure).

Now click the Accessories link (to the accessories product category archive at hidden link). It goes to a 404!

Change the permalinks so that products and product categories don't use the same base and then everything works normally.

(If they want to check the back-end, they can log in with this link: hidden link)

I suggest the use products for the product category base, and /product/%product_cat%/ for the custom product base (which seems sensible when displaying single products).

They further noted the said issue as non-resolvable. So I believe that above mentioned explains the reason quite well and you can adopt accordingly.

August 8, 2024 at 1:38 pm #16053040

T4ng

Hi!

I think we face the very exact same issue on our website.

The permalink structure has the same "design":
Shop page: shop
Product base: shop/%product_cat%
Product category base: shop

While I understand what you mean, It's bit frustating.

Us, as shop owners, try to keep our store URLs consistantn since it to help visitors AND search engines to find their way easily across this store.

so that it most cases, it doesn't make sense to have a store entry page under a specific folder, and the produts it includes under another.
Especially when that store URL is shop, or store, since it wouldn't make sense to set the product base to shops/%product_cat%.

August 8, 2024 at 2:02 pm #16053158

T4ng

Not to mention this kind of structure is what's recommended for SEO.