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

Last updated by basv-25 1 year, 5 months ago.

Assisted by: Osama Mersal.

Author Posts
July 5, 2023 at 9:47 am #13948461

basv-25

All links in my website are automatically linked to the content in the right language, thanks for that WPML!

But I experience an issue with the link to my woocommerce shop page / or woocommerce categorie page. This always directs to the default language.

I have created a test page with 3 links:
hidden link

One link directs to the woo shop page (sometimes goes to the default language shop page, depending on which language you're on)

On link directs to a woo categorie page (sometimes goes to the default language categorie page, depending on which language you're on)

One link directs to a regular page (goes to the correct translated page)

In my experience it is always one link that doesn't direct to the current language, sometimes the shop page, other times the categorie page. They never direct both to the current language.

Hope you can help, Thanks so much!

July 5, 2023 at 10:29 am #13948849

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

Please make sure that these pages are translated and published.

If they are translated and published, please check if you can see them in the translation editor while translating the page. Kindly check our guide about translating URLs in the translation editor. (https://wpml.org/faq/how-to-translate-urls-shortcodes-and-html-attributes-using-the-advanced-translation-editor/#translating-urls-with-the-advanced-translation-editor)

Best regards,
Osama

July 5, 2023 at 10:51 am #13949177

basv-25

Hi Osama,

Thank you for your prompt reply. These urls are translated via WCML (see printscreen).
I use a regular text link hidden link to link to my shop page.

Maybe there is another / better way to create a link to a woocommerce page so that WCML know they need to refer to the translated WCML url?

As said earlier, this happens only to these WCML urls. All regular pages are linked towards the linked translated pages perfectly.

Thanks

Scherm­afbeelding 2023-07-05 om 12.47.02.png
July 5, 2023 at 10:56 am #13949335

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for your update. Would you please try the following steps to test if the URLs appear in ATE?

1- Edit this page in the default language. (hidden link)
2- Make a minor edit in the page title and update it
3- Update the Danish translation
4- Using the top left corner search box, search for the shop page URL
5- If you find it, please translate it and update the translation

Kindly let me know the result of the above test.

Best regards,

July 5, 2023 at 11:01 am #13949381

basv-25

Thanks, I tried above steps but I can't find the url field.
In the search box I entered: hidden link and /links but the url doesn't appear...

July 5, 2023 at 11:04 am #13949387

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for your update. I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP)
– preferably to a test site where the problem has been replicated if possible –
in order to be of better help and check if some configurations might need to be changed.

Your next answer will be private, which means only you and I can access it.

❌ Please backup your database and website ❌

✙ I would need your permission to de-activate and re-activate the Plugins and the Theme and change configurations on the site. This is also a reason the backup is critical.

✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.

Best regards,

July 5, 2023 at 11:36 am #13949707

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for the access details. I checked the page and found the <!-- wp:paragraph --> tag in the text, so I deleted it. (Kindly check this hidden link)

After that, the URLs appeared correctly in ATE. (Kindly check this hidden link)

Please translate the URLs, clear the cache, and check the issue on the front end.

Best regards,
Osama

July 5, 2023 at 1:32 pm #13951119

basv-25

Hi Osama, now the link can indeed be translated.

But this would mean that I would manually need to translate all the links through our website that point to our shop page. And this is 30 languages. This is not workable and will result is faults and broken links. All other links (pages / posts / projects / products) are automatically processed in the correct language. I would expect the same for the shop page.... Your help is very much appreciated. Thanks

July 5, 2023 at 1:41 pm #13951235

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

This is the workaround for this case, but if this workaround is not suitable for you, please check if the issue persists in a minimal environment by following these steps.

1- Deactivate all the plugins except WPML CMS, String Translation, WooCommerce, and WooCommerce Multilingual.
2- Switch to a WordPress default theme like Twenty Twenty-one.
3- Create a new test page using Gutenberg editor, and translate it.

If the issue is gone, activate them one by one to see which one is causing an interaction issue.

❌ Please backup your database before performing the above test ❌

Best regards,
Osama

July 5, 2023 at 2:00 pm #13951393

basv-25

Hi Osama,

Thank you once more for your reply,.

I create a clean environment with only woo commerce + wpml and twentytwentythree theme.

Hereby the link to the page:
hidden link

The issue still seems to persist also in this minimum setting.

Can you have a second look? Thanks so much,

July 5, 2023 at 3:59 pm #13952457

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Please log in to this sandbox site. (hidden link)

After that, please check this page and let me know if it's the same issue you face on your site. (hidden link)

After your confirmation, I'll consult our 2nd tier support team regarding this issue.

Thanks,

July 5, 2023 at 6:54 pm #13953495

basv-25

Hi Osama, thank you for recreating this issue, it is indeed the same as we experience.

Thanks, hope 2nd tier support has a solution,

Enjoy your evening!

July 6, 2023 at 6:36 am #13955105

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

I've consulted our 2nd tier support team, and I'll update you as soon as I get their reply.

Best regards,

July 6, 2023 at 7:32 am #13955859

basv-25

Thanks Osama

July 6, 2023 at 7:53 am #13956071

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Our 2nd tier support team has found a workaround for this issue. Please check the following steps:

1- Edit the (wp-content/plugins/sitepress-multilingual-cms/inc/absolute-links/absolute-links.class.php) file
2- After the following code line 204

$post_name     = false;
$category_name = false;
$tax_name      = false;

Add this code

if( $permalink_query_vars["post_type"] == "product") {
$check = get_page_by_path( $dir_path );
if ( $check instanceof WP_Post ) {
$post_name = $check->post_name;
$post_type = $check->post_type;
	}
}

3- Go to WPML-> Settings
4- Run the "Scan now and adjust links"

I've applied this workaround on the sandbox site, which fixed the issue. Please confirm the fix on the sandbox and apply it to your site.

Best regards,