Home›Support›English Support›[Resolved] Woocommerce rest api only returning orders of website default language
[Resolved] Woocommerce rest api only returning orders of website default language
This thread is resolved. Here is a description of the problem and solution.
Problem: If you're experiencing issues with the WooCommerce REST API only returning orders made in the default language of your website, and not displaying orders from other languages, this might be due to the translation settings for the Order post type. Solution: We recommend checking the translation preference for the Order post type in your WPML settings. Here's how you can adjust it: 1. Navigate to WPML > Settings. 2. Scroll down to the "Post Type Translation" section. 3. Set the translation preference for Orders (shop_order) to "Not Translatable". 4. Save the changes. After making these adjustments, try fetching the orders again using your API endpoint. You should now be able to see all orders, regardless of the language.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your specific case, 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 further assistance is needed, please do not hesitate to open a new support ticket at WPML support forum.
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.
Background of the issue:
I am trying to connect different applications to our WooCommerce store using the REST API. When they call the Woo API 'get many orders' (hidden link), the API only returns all orders made in the website default language (NL). However, when retrieving a specific order ID made in the other language (hidden link), there is no issue.
Symptoms:
The API only returns orders made in the default language (NL), while orders made in the other language (FR) are missing.
Questions:
Why does the WooCommerce REST API only return orders in the default language?
How can I retrieve orders in all languages using the WooCommerce REST API?
CURRENT STATUS:
When using hidden link we get only NL orders
When using hidden link we get only NL orders
When using hidden link we get only FR orders
When using hidden link we get only NL orders
NEEDED:
When using hidden link we need to get ALL (NL+FR) orders
PROBLEM ANALYSIS:
Deactivating WPML
After deactivating the WPML plugin, we do get back all NL + FR orders when using the standard API endpoint url hidden link.
Check earlier versions of plugins
I tested the API in a backup environment (backup date 2024-09-12) running Woocommerce Version 9.2.3, WPML multilangual CMS Version 4.6.13, WPML String Translation Version 3.2.14.
In this environment, we do get back all NL + FR orders when using the standard API endpoint url hidden link.
Order language filtering
I guess it stopped working since the orders got a language filter in the wordpress backend. See screenshots.
PLEASE PROVIDE A FIX ASAP as our FR orders are no longer being picked up by our Sendcloud integration (our shipping provider) resulting in FR-customers no longer receiving their packages.
Before this thread is assigned to my colleague, I’d like to provide some initial guidance and potential solutions.
Based on the WPML Debug Info, I noticed that the translation preference for the Order post type (Orders (shop_order)) is set to "Translatable - only show translated items". With this setting, orders created in a specific language will only appear when querying orders in that particular language, while orders made in other languages will not be shown.
This is why, when you request to view all orders, only the orders from the default language are displayed, while those in other languages do not appear.
By default, the translation preference for the Order post type is set to "Not Translatable" so that orders from all languages can be viewed. Please try the following steps and check again:
- Go to WPML > Settings and scroll down to the "Post Type Translation" section.
- Set the translation preference for Orders (shop_order) to "Not Translatable" and save the changes.
Once done, try fetching the orders using the endpoint. You should now see all orders, regardless of the language.
Please try and let us know how it goes. We'll be happy to help if you need further assistance in this matter.