Skip Navigation

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

Problem:
The client was experiencing two issues on the WooCommerce checkout page with WPML:
1) The product title on the order-pay endpoint page was not translating to the current page language but remained in the language the order was made in.
2) On the order-received page, the permalink slug for certain variable products with multiple attributes was in the wrong language.

Solution:
We recommended the following steps:
1) Go to WooCommerce > WooCommerce Multilingual > Status and complete any missing steps.
2) Navigate to WooCommerce > WooCommerce Multilingual > Store URLs and ensure that:
- Slugs are unique and not repeated across translations.
- Translations do not have the same slug as the original language.
If these steps are completed and the issue persists, we provided a code snippet to temporarily change the order language to English, retrieve the product information, and then revert the language back to the original. The client should add this snippet to their functions.php file. (fond here: https://wpml.org/forums/topic/woocommerce-product-title-etc-on-pay-order-checkout-page-in-wrong-language/page/2/#post-10513689 )

Please note that this solution might be outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If necessary, please open a new support ticket with us."}

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

Last updated by Alejandro 2 years, 2 months ago.

Assisted by: Alejandro.

Author Posts
January 3, 2022 at 11:37 pm #10280233

ingoZ

Hello,

I have observed multiple WPML related errors on the woocommerce checkout page:

1) On the woocommerce checkout order-pay endpoint page the product title ( which is received via $item->get_name() ) is always in language the order was made in. So if the order was made in a specfic language, the product title shows on the order-pay page of any language in this specific language the order was made in instead of translating it to the page language. This error with the product title does not happen on the other checkout pages or the order-received page. I switched to a different theme and the problem is the same.

2) On the woocommerce order-received page: Certain variable products that have multiple attributes have a problem with the slug in the permalink being in the wrong language. This may be specific to certain products and I have not found out yet why.

Please request admin access from me so I can send you the access here in private so you can check on the issues.

January 4, 2022 at 1:10 pm #10284431

Alejandro
Supporter

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

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

Hello!

1) Please go to WooCommerce > WooCommerce Multilingual > Status
Follow the steps missing there please.

2) WooCommerce > WooCommerce Multilingual > Store URL
Translate the fields you see there taking the following into consideration.

- No slug can ever be repeated. if your shop page's slug is "shop" then your product base slug can't be "shop" or "shop/%category%" or anything similar.

- The translations cannot have the same slug as the original language's. if your shop's page is "shop" then you can't translate the slug into "shop".

Try it out and let me know how it goes.

January 4, 2022 at 8:26 pm #10287447

ingoZ

Your answer is not related to my question, please read again what my issue is. I am talking about the product title, the products permalink etc but specificly on the checkout pages.

Please request my admin access so I can show it to you live on my site!

January 5, 2022 at 2:27 pm #10292569

Alejandro
Supporter

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

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

I did understand your problem, but in order to even move forward, the endpoints need to be translated with the steps that i gave you before, as well as the product base slug and the shop, which are mandatory to be translated for everything to work correctly.

If these steps are not done, then things won't work correctly.

Please confirm you have done it so we can move forward.

-------------------------------

- I know you think this has nothing to do with what you explained but it's one of the reasons why the content do not work correctly when they are shown using the endpoints.

- Having access to the site would not help me much if i don't have the correct instructions on how to recreate the problem, so please let me know how can i recreate it

- you mentioned this happens even with a default theme. could you confirm i can disable the theme and plugins whe testing?

Thanks in advance.

January 8, 2022 at 1:15 pm #10310277

ingoZ

Any news on that issues?

January 8, 2022 at 4:33 pm #10310767

Alejandro
Supporter

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

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

I tried accessing your page but the credentials provided were wrong. the password is incorrect. can you please double check it and make sure it's an admin role account?

Thanks in advance.

January 11, 2022 at 12:19 am #10322531

ingoZ

Sorry I have changed the website test environment I provided you with to a different version because you had taken a long time to answer and I had to test some other things on it. If you tell me now that you can test it right away this or the next day I will revert the change so you can sign in with the given login credentials.

January 11, 2022 at 9:07 am #10324769

Alejandro
Supporter

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

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

It all depends on when you send the changes. i'm working from monday to thursday and then saturdays (8-5pm CET), so it shouldn't be a problem.

You can send me the credentials and url again so i can take a look at it.

January 12, 2022 at 9:06 am #10333419

Alejandro
Supporter

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

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

I'm cloning the site to one of our staging servers so you can keep working on it: hidden link

i can check when it finishes and start working on it. i'll come back with any questions i have in case i get stuck or can't reproduce the problem.

January 12, 2022 at 1:52 pm #10336227

Alejandro
Supporter

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

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

I saw the problem and i'd like you to watch this video: hidden link

I can see that the domain is called correctly, but the actual product slug + category, etc, is not and it's always being called in German.

However, i had a hard time doing ths because i kept getting a weird error:

[12-Jan-2022 12:55:02 UTC] PHP Fatal error:  Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, string given in /mnt/BLOCKSTORAGE/home/219768.cloudwaysapps.com/stmkgzqjxd/public_html/wp-content/plugins/woocommerce/includes/class-wc-product-variation.php:174

How exactly are you adding that product on those pages (in what file and what line of code)? that way i can try to check what's going on.

You can check the cloudways site below with your own credentials or the ones you gave me:

hidden link

---------------
NOTE: the links here are only seen by you and me, they are masked for everyone else.
---------------

Regards.

January 12, 2022 at 11:09 pm #10339645

ingoZ

Awesome that you looked into it that closely and took a video to go through it.

First of all to make sure its clear, the order-pay page is not an entirely custom page. In fact, the order-pay page is a default woocommerce checkout endpoint page. I simply customized the woocommerced template in mytheme/woocommerce/checkout/form-pay.php as it should be to add the "Pending Order" headline and various other changes. The permalink issue, however, is happening both on the English order-pay and on the English order-confirmed page.
Furthermore, to let you know, despite the order status now is set to "Order complete", not only the order-confirmed paged but also the order-pay page still is accessible and showing the same as if the status was on "Payment pending".

To elaborate on a few things of the video:

At 00:30) you switch from the German to the English page via the language switcher. But this is not related to the issues I describe. This here is another issue of the language switcher which is just occurring on the order-pay page whereby the 'key' parameter in the query string is not attached and thus the url does not properly show the order content. As you correctly stated, if you open the correct url directly in any language it is working.

01:15) Correct, on the English language version of the order-pay page the base base/slug and taxonomy term in the permalink of the product is from German (in which the language was ordered originally) and not from English as it should be and thus the permalink does not work. So it appears the permalink base is always shown in the checkout page of any language in the language that the order was originally placed in.

02:40) This assumption is not correct, I do get the broken permalink not in separate parts but as a whole via $_product->get_permalink() which you can see as mentioned in the form-pay.php file.

January 13, 2022 at 2:15 pm #10344513

Alejandro
Supporter

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

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

1) I know that the endpoints do most of the work, on the video i was referring exactly to that extra section you added with the product which is suspect is on the functions.php file hooked to the checkout and thank you page, maybe?. i tried to quickly search it on the thankyou.php/form-pay.php page and couldn't find anything about it. can you point me to the code file and line so i can scan it and see if i can find any clues about it?

1.1) Can you also tell me what is that feature suppose to do? because it might be this why i couldn't find the code. i did spot some not standard code there but the cloudways site doesn't show the product anymore and throw an error instead so i can't really test it anymore.

2) The metadata seemed correct on my end. it was in the correct language everytime (whether i accessed the page directly or through the language switcher) and it was only the link the one that was incorrect, and it can be seen in the video, so please let me know if i missed something that can be seen on the video so i can re-check

3) I can see a LOT of errors in the theme, they are all about deprecated code. would it be possible to use the same template on another theme, so we can isolate the problem even faster?

------------------------

4) I believe the link issue can be fixed by going to WPML > settings > Post type translation > Products > Set it to "translatable - only show translated items".

Let's try to focus on the wrong link issue first and see if they help with the other errors as well.

Regards.

January 20, 2022 at 8:27 pm #10397665

ingoZ

Sorry for the late replay, I am back focused on this issue now.

1) Which part do you mean? The "Pending Order" section and changes are in fact in the theme woocommerce template under mytheme/woocommerce/checkout/form-pay.php so I am not sure why you did not find it.

1.1) Which feature are you refering to?

2) Uhm, as you showed in the video yourself, it did not work when you switched on the order-pay page to the other language because the "key" parameter in the url was missing in the other lanuage (meaning the permalink from the language switcher did not include it).

3) Yes the same error does also appear on another theme so its not related direclty to the theme. The errors which are part of the theme are minor errors which should not effect this.

4) That is not a workaround for me because I need this option to be set like that. I need have multiple languages and some such as German has the products translated and others such as Italian does not have them translated but nevertheless should show the original language products.

The same issue with the permalink remains. Would really need to fix this urgently. Have you made any progress on why this happens?

January 21, 2022 at 9:40 am #10400931

Alejandro
Supporter

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

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

Let me rephrase in a clearer way:

You mention you have added code to some templates files where you added this section that is not working correctly.

I need to know the exact changes you made in those files, because by default we can't debug custom coding (which is what this is. custom coding is out of the scope of our support).

I want to help you out here but i need you to give me this information first, so i can then try to find what else i might need for this.

-------------------

In short i need you to tell me the following:

- Where in the code (exactly where, what part of the code) did you add these sections
- How do you then handle them in wp-admin
- Write the steps to recreate one of these sections (i wrote X code here, i configured Y there, etc) so i can follow those steps and try to figure out what's wrong with them.

I need to test this problem WITHOUT any other plugin, so i need to know which of the plugins installed on your site should be left enabled for that feature you created to work correctly.

---------------------------

At this point, if you can allow me access to a staging environment, that would definitely help as well, because on the staging site, that section works only 1 after many many reloads, which suggests that it also needs some other plugin to work other than ACF, WPML and WooCommerce.

January 22, 2022 at 9:51 pm #10410529

ingoZ

I thought you had the original staging site duplicated already. Anyhow, I have set up the staging site now again (same login credentials I have provided before). Please make a duplicate.

I have modified the staging site now so that only the necessary WPML + Woocommerce plugins enabled and switched to the standard twenty-one theme. The only change in the code I have made is adding a customized form-pay.php woocommerce template. But as mentioned, the permalink issue happens on the non-modified order-received page too. So it seems not related to any custom code. I have investigated it a little by myself and it appears that the issue only occurs when the WPML string translation add-on is enabled. Maybe that will help you find out the reason.

Furthermore, I have also simplified the permalink structure to not include any placeholders but just DOMAIN.COM/artwork/PRODUCTNAME. Just consider this because this leads to the permalinks being redirected automaticly from /kunstwerk/guardians-of-time-sitting/ to /artwork/guardians-of-time-sitting/ but the permalink itself is not fixed, the link remains wrong as follows:

On the English order-received page
hidden link
The permalink of the product here is
hidden link
Instead of the following it should be
hidden link
using the German instead of the English slug.

Same problem occurs on the English order-pay page
hidden link

Plus on the German order-pay page, as also mentioned, the product title is in English instead of German:
hidden link

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.