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: Bug
This topic contains 14 replies, has 3 voices.
Last updated by Shekhar Bhandari 1 year, 10 months ago.
Assisted by: Shekhar Bhandari.
Author | Posts |
---|---|
May 25, 2023 at 10:28 am #13715207 | |
nortech |
The site is test environment (dev site) from live site We have an issue with WPML and WooCommernce API When we try to do the below call hidden link we receive { If we call hidden link or hidden link it works fine and we get the expected results The authorization type we use is with JWT BearerToken and you can get the token with the below call and json body hidden link and post the json { If we try to connect with OAUTH 1.0 and use Woocommerce API keys it works fine, even with ?lang=en |
May 29, 2023 at 8:21 am #13729689 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, Thank you for contacting WPML support! So it goes through JWT Authentication for WP-API? In our forum archives we had few cases where this plugin was interfering with our plugin functionality. Therefore can you have a look at this, does it help? Regards, |
May 30, 2023 at 1:54 pm #13740535 | |
nortech |
Am trying to update products, categories, terms from Rest API. My problem is that when am updated the main category, product, etc am losing the translations array is getting override. To be more specific I have the below json /wp-json/wc/v3/products/categories/batch ] When I post this everything is how I expected to be { When I try to update only the English version only { I get the translation array override and am losing my Greek translation { My main issue with that is that, we get the Greek version from an external system and we import it through RestAPI and then people from inside wordpress they put the translations for English. Which means I don’t have available the option to send through API both language but one. And when I try to update anything I lose the translation array. Is there something we can do? Add on our json or any snippets so we don’t have that issue? Thank you |
May 30, 2023 at 2:02 pm #13740575 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, This is what is supported as of now: Can you check if you can find something you need within this documentation? Perhaps using a lang parameter in the request? Regards, |
May 30, 2023 at 2:15 pm #13740641 | |
nortech |
So when we upgrade the basic language we should also send the rest, otherwise in the upgrade the basic language will be replaced and we will lose the table of translations? |
May 31, 2023 at 7:02 am #13743491 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, Can you perhaps share a screencast also to show this process? This will help us understand this better. Just do it for one product or category when the override occurs. If you're creating translations using REST API, how does manual adding of these translations within WordPress combine with this? You can use tool such as hidden link the show the whole process and where the issue occurs. Regards, |
May 31, 2023 at 8:45 am #13744355 | |
nortech |
Hello. hidden link if you need better quality please download it. Thank you |
June 1, 2023 at 11:04 am #13753121 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, I talked with our 2nd tier about this also, but are unsure if we understand the issue properly. Is it that the code is not receiving the option "translation_of" and is therefore overwriting the contents and unlinking the categories from another? Is this what you are describing - e.g. you pass just one of the translations without the other translation and this overwrites the language relationships? Any additional explanation is welcome. Regards, |
June 1, 2023 at 11:29 am #13753287 | |
nortech |
Hello. If I do any updates on the category, in the main language, the translations array is get override and loses the information of other translations on my example "translations": { "en": 231, "el": 24 }, when I do any updates on the main language, description price, anything i just do a post for this category I get "translations": { "el": 24 }, which means I lose the connections with the other translations... and the other category has "translations": { "en": 231 }, this happens to anything that has this table, products, terms, etc if you need any more info let me know please |
June 1, 2023 at 2:29 pm #13755413 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, On this sandbox: are you able to reproduce the issue and show us with one simple example? Feel free to install whatever is needed. Regards, |
June 5, 2023 at 9:38 am #13768661 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, I see - so you trying to update both the original and the translation categories in the same request. I'm not sure if this is yet supported, however we will debug and check if possible. Furthermore, we have the logic to sync the categories between languages and this could also be a part of the issue. This is escalated to our 2nd tier team and may take some debugging time, I'll get back to you as soon as I have any news or questions for you. Regards, |
June 6, 2023 at 6:20 am #13775235 | |
nortech |
Good morning. I want to update only one language, the default one, and stop there. The problem is, when I do the update, for only the default language, It overrides the translations array and keeps only the default language, so I need to update the second language as well, else my category or product has only one language instead of two. As I mentioned this issue is on category, products and terms. I have the same problem with all |
June 7, 2023 at 6:04 am #13782045 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, Can you try this - in wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering/class-wpml-term-query-filter.php, replace: if ( ! empty( $args['slug'] ) ) { $args = $this->adjust_taxonomies_terms_slugs( $args, $taxonomies ); } with: if ( ! empty( $args['slug'] ) && !wpml_is_rest_request() ) { $args = $this->adjust_taxonomies_terms_slugs( $args, $taxonomies ); } and then run your request, does it help? Regards, |
June 7, 2023 at 8:20 am #13782907 | |
nortech |
Hello, I did the change, but still when I try to do a simple update, like change the name of a category, only for the default language, the translations array gets override and I only have the default language and I lose the translation id I had for the English version This is the exact post am posting { "update":[ { "id": 24, "name": "Αξεσουάρ", "lang": "el" } ] } before i do the post my category with 24 had En and EL translations after the post it only has the EL Thank you. |
June 8, 2023 at 1:59 pm #13793613 | |
Shekhar Bhandari WPML Supporter since 03/2015
Languages: English (English ) Timezone: Asia/Kathmandu (GMT+05:45) |
Greetings, Since Bruno is currently away on vacation, I will be responsible for handling this ticket from now on. Upon further examination, along with our second-tier support, we have discovered the following: Updating in original language Alternatively, you can attempt to update the original product category without the "lang" parameter, and it should function properly. Updating in secondary languages If the "translations_of" parameter is omitted, we consider it as an independent category without translations, which is the current scenario. For more information and details on the "translation_of" parameter, you can refer to this link: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/#:~:text=translation_of%20(optional)%20%E2%80%93%20the%20product%20will%20be%20created%20as%20a%20translation%20of%20an%20existing%20product%2C%20having%20the%20ID%20provided%20by%20the%20value%20of%20translation_of.%20If%20translation_of%20is%20omitted%2C%20the%20product%20is%20created%20as%20part%20of%20a%20new%20translation%20group%20(trid) Please let me know if including the "translations_of" parameter resolves your issue. Thank you. |