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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - |
- | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - |
Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)
Tagged: Documentation request
This topic contains 13 replies, has 2 voices.
Last updated by Long Nguyen 1 year, 3 months ago.
Assisted by: Long Nguyen.
Author | Posts |
---|---|
August 18, 2023 at 3:20 pm #14253415 | |
shalomg |
While testing, we were able to use the language parameter to retrieve Products in individual languages, but there appears to be an issue as requests made per WPML's documentation do NOT work as documented (specifically, passing 'all' as a language parameter). I have restated the issue & outlined next steps below to stay organized. Issue This causes issues with other plugins daily product sync requesting product data. How We Tested I am trying to: Link to a page where the issue can be seen: I expected to see: Instead, I got: |
August 21, 2023 at 7:23 am #14260229 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi there, Thank you for contacting WPML support, I'd be happy to help you with this issue. I assume that you are following the documentation below to get the products via Rest API I've tested this feature on my demo site and see it works properly. Can you please try to replicate the issue on a clean installation of WordPress? With the link below, you can log in directly to the admin area Kindly follow the steps below: - Don’t restore your site there. Look forward to your reply. |
August 24, 2023 at 12:45 am #14280991 | |
shalomg |
Hi there, Will circle back shortly. |
August 24, 2023 at 1:16 am #14280999 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, I'm waiting for your feedback. Thanks. |
August 24, 2023 at 2:43 am #14281087 | |
shalomg |
Hi there, in my tests with QPilot they tell me that we have to install this so that the Woo REST API can reply in a straight forward manner. hidden link Is that a fact ?? If yes then why it's not an addon? Why do I need to have my service hosting side load stuff? Can you confirm that the tests you did in your environment don't have that php wrapper installed? |
August 24, 2023 at 5:15 am #14281491 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Yes, you need to add the PHP library "WooCommerce REST PHP client library" to your project to interact with the WooCommerce REST API in a more straightforward way. You can use other client libraries as well. In my test case, I also installed that PHP library to retrieve products in a specific language or "all" language. If yes then why it's not an addon? Why do I need to have my service hosting side load stuff? You can read more about WooCommerce REST API Client Library here to know how it works hidden link I hope I was helpful. Don't hesitate to ask if you find any problem along the way, I'll gladly help you. |
August 24, 2023 at 1:49 pm #14286161 | |
shalomg |
Dear Long, The document you send me is from 2014 ! Again my huge concern is that I install WPML, the plugins sort of get in the middle of the standard WordPress architecture and to be able to interact normally with the REST API and have the parameters working properly I have to go and install something else?? Do you think that this makes sense? |
August 28, 2023 at 2:42 am #14297053 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Without WPML, the PHP client library is recommended for use by WooCommerce in their documentation to interact with WordPress Rest API. There are many PHP libraries that can work with WooCommerce Rest API (for example hidden link), maybe other plugins have a PHP library or custom code in their source code to work with WooCommerce Rest API. And currently, it is not available in WPML source code and you need to install it on your plugin or theme to use that feature. Thanks for your understanding and patience. |
August 31, 2023 at 9:23 pm #14323711 | |
shalomg |
I see. I understand now that it's Woocommerce who is reportedly the one requiring that library? The document seems to be quite old (2014) so I wonder if that is still relevant. |
September 1, 2023 at 2:01 am #14323993 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, The documentation from 2014, still has value in knowing how WooCommerce Rest API works till now. In our case, we suggest using a library of Automattic, you can use another library, or some lines of custom code that fit your case. Thanks. |
September 3, 2023 at 3:48 pm #14332143 | |
shalomg |
Well, it seems it's not the case. An engineer from Woocommerce just confirmed the document is obsolete and must not be used anymore. Please see his response where he reiterates that it's WPML responsibility to return the products in the language specified with the parameter lang and not just the default as it happens now without having to install any extra library at all. Please read the whole answer from him and if necessary escalate the issue to T2 or the dev team. Thanks! ------------------------ Woo response ----------------- John (Woo) Sep 2, 2023, 15:50 UTC Hi Alex, Thanks for the reply. If a plugins wants to interact with the REST API and fetch product information for example they need to have the library above installed? No, don't use that library. It is over 8 years old and you should be able to obtain all of the information necessary, including a link to the technical documentation, which can be found here: https://woocommerce.com/document/woocommerce-rest-api/ I'll circle back to your request: One of our plugins need to fetch product information in 'all' languages configured in WPML. Only the products in the default language are returned. If you review the WooCommrece API documentation above, you'll see that WooCommerce only supports the language parameter, which only fetches the WordPress language. The lang parameter isn't from WooCommerce but rather WPML's API. That said, WPML's support team will have to help the AND condition when making a request. If you're not finding the help you need from WPML and if the developer documentation doesn't include what you're looking to achieve, you might want to check out our advanced WooCommerce Community in Slack: https://woocommerce.com/community-slack/ or the Advanced WooCommerce Facebook Group: hidden link There are many developers gathered in those communities, including the authors of our plugins, so their coding advice should be a great addition to the support from WPML. As a side note, AutomateWoo has the ability to generate more revenue through marketing campaigns to users based on their purchase history. Is this something you'd like to add to the business? |
September 4, 2023 at 5:18 am #14333461 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Following the WooCommerce documentation (hidden link), I can see the Rest API returns the products in all languages without the extra library (Postman app), please check this screenshot hidden link So then how do you interact with WooCommerce Rest API, handle the JSON data returned, and display products in the frontend on your site? If you use PHP language: Also, we suggest using the PHP client library from Automattic in the documentation, which has the last release on March 2022, screenshot hidden link Now, can you please let me know how you get the WooCommerce products via Rest API in your case? Look forward to your reply. |
September 4, 2023 at 6:54 pm #14339055 | |
shalomg |
Thanks so much again for the great support. In your screenshot of the response to the POSTMAN I see only one product id not multiple ones which what I need. Our use case is not about displaying products on a page but it's a plugin that manages product subscriptions (auto ship) and the platform needs to sync all the time every product so that it can be scheduled. What's happening as it's explained in the first contact is that since the French translations are considered different products for the plugin they need to be synced and when they fetch the list of products with the parameter lang=all only the products in English (default) are part of the response. |
September 5, 2023 at 3:30 am #14339643 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Here is the screen record of the test case with Postman hidden link products in all languages are retrieved via Rest API. And now, I understand that the issue here is not about the compatibility between WooCommerce and WPML. It is the compatibility between "WooCommerce-WPML" and "Autoship Cloud powered by QPilot". As I mentioned in the previous ticket (https://wpml.org/forums/topic/information-requests-failing-blocked-for-translated-products/), this plugin is not available in our list of compatible plugins. Please contact the plugin author and ask them to join our Go Global program where our Compatibility developers will help them to make their product compatible with WPML. Thanks. |
The topic ‘[Closed] Language parameter ('lang=') does not return all products’ is closed to new replies.