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: Exception
This topic contains 3 replies, has 2 voices.
Last updated by Prosenjit Barman 1 year, 10 months ago.
Assisted by: Prosenjit Barman.
Author | Posts |
---|---|
February 14, 2023 at 10:50 am #13029407 | |
xavierD-17 |
Hi, i am encountering an issue since the last plugin update. The backend orders are now coming through with the ID product always in the default language (english) but the ID VARIANT is changing depeding on the customer's user language. This is causing major issue as my order managing system which is connected via API can't recognise the product anymore as products have the ENGLISH IDS in their system (woocommerce default language). |
February 15, 2023 at 4:58 pm #13042817 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hello There, After inspecting the Variation ID and Product ID in my development environment, I have successfully been able to identify the same issue. It appears that the Product ID and Variation ID do not match at all. For your information, The ID of the product on the order details page is actually getting changed according to the language set for the profile. You can check that by changing the profile language from User > Profile > Language. However, I already have discussed this issue with the 2nd-tier team and am delighted to inform you that there is a workaround for this issue. I tried that workaround and can confirm that it's working perfectly. For now, you can use the workaround below: - Make sure to take a full backup of your site including the database. - Replace: if ( 'product_variation' === get_post_type( $item->get_product_id() ) ) { - With: if ( !empty($item->get_variation_id()) ) { Please note that changes will only be visible on the order details page for new orders, that are placed after the code has been added. For older orders, the item details have already been adjusted and saved in the database. Therefore, it's not possible to modify that information. I hope you can understand. Please try and let me know how it goes. Let me know if there are any other concerns that need to be addressed. I will be happy to help. Best regards, |
February 16, 2023 at 10:33 am #13047479 | |
xavierD-17 |
Hi Prosenjit, Thank you so much for your assistance. I have added the code you sent and it has fixed the ID VARIANT issue, now it is english no matter the Customer's language. However, I, now, have the PRODUCT ID in the customer's user language, which was not happening before. Could you give, please, me also code so that the PRODUCT ID stays in english (site's default language) as it was before adding the ID VARIANT code? Many thanks, |
February 17, 2023 at 2:12 pm #13057921 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hello There, If I'm understanding correctly, you want the Product ID that is defined for the English language to be displayed on the order details page, regardless of the language in which the product was purchased. As you know, the Product ID changes with each language. Mapping the Product ID to a specific language would not be feasible due to the potential issues it could cause in the database. Furthermore, this is not a standard approach. However, I would like to inform you that providing a custom code or solution falls outside the scope of our support. We are always ready to assist you with any issues related to our plugin within the parameters of our support policy. I hope you can understand the matter and am sorry for any inconvenience this may cause. If you want, you can also hire a professional developer who can help you to accomplish your custom requirement as per your needs. More information is available here: https://wpml.org/contractors/ If there's anything else I can help you with, please don't hesitate to ask. It would be my pleasure to assist you. Best Regards, |