Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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

Last updated by Jamal 4 weeks ago.

Assigned support staff: Jamal.

Author Posts
October 8, 2019 at 9:52 am #4713751

sanjaK

I am using API to create products and variants of products. I've uploaded product data, vriations and everythig through API. Everything is set up and working fine, except, i have to press manually "Synchronize attributes and update product variations" button. After that, everything is just as it should be.

IMHO, it should be possible to do that through API, to do this synchronization. Am I missing something? How can this be done?

October 9, 2019 at 3:12 pm #4723959

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for contacting WPML Support. I will be glad to help with this.

I am not sure how to answer your question. Maybe I'll need more information about this.
I assume, you are following our documentation and settings the "translation_of" attribute correctly.
https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/#create-products

Is this happening with all the variable products on your website? Can you explain what do you notice wrong before using "Synchronize attributes and update product variations"?

How are the variations created? With local or global attributes?

Would you like to reproduce this behavior in one of our clean installs? If yes, please use this website hidden link

Looking forward to your reply.

Best regards,
Jamal
WPML Support

October 14, 2019 at 10:20 am #4748953

sanjaK

Thank you Jamal for answering!

I will try to clarify. I am using API to upload product data. Most of my products are of type "variable". I have only one attribute on variable products, attribute is size and it is global. I am using three languages, i.e. "en", "de" and "fr", first one, "en" is primary, but that is of no particular importance.

Products are created using API, it this order:

- Product 1, language "en"
- Product 1, all of the variations (sizes), stock managed at variation level, importnat!
- Product 1, language "de", translation_of: product1
- Product 1, language "fr", translation_of: product1

After that, product 1 appears with all of the variations only in primary language "en". Switching to "de" or "fr" displays product but without Attribute, without sizes, there is no combo for size selection displayed. In place of combo box for size selection there is message: "This product is currently out of stock and unavailable." (in "de" of "fr").

Then, I have to go to admin panel, WPML -> Taxonomy translation -> Select my Attribute from selection combo box. At the bottom of page button appears with caption "Synchronize attributes and update product variations". After pressing this button, my translated product in secondary languages "de" and "fr" is showing sizes.

My question is about that last step, and activating this synchronization through API, of in some other way.

Just to be complete, this last step can be achieved from admin panel, and choosing WooCommerce -> WooCommerce Multilingual -> Attributes -> ... and so on ...

I will try to reproduce behavior, but need some additional time.

October 14, 2019 at 11:06 am #4749211

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hi,

Thank you for the explanation. I don't think that we have a supported API to synchronize stock, you can refer to our WooCommerce Multilingual API here:
https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/

I'll let you some time to reproduce this and I'll be glad to continue with you.

In the meanwhile, I would like you to test, only for german, using translation_of for variations too.
- Translate attribute size to german for all terms.
- Product 1, language "en"
- Product 1, all of the variations (sizes), stock.
- Product 1, language "de", translation_of: product1
- Product 1, language "de", all of the variations (sizes), stock using, using translation_of:each variation.

Looking forward to your reply.

Best regards,
Jamal

October 21, 2019 at 2:39 pm #4795295

sanjaK

Hi Jamal!

I have tried to do as you have suggested. No luck there. Could be I am doing something wrong. Nevertheless, unfotrunately I do not have time to debug this further, especially if there is a function that I can execute on server using PHP code that would actually "Synchronize attributes and update product variations"?

This question has probably been answered somewhere on this forum, I appologize for not taking enought time for searching!

As you have said, there is no possibility to do sync using API, so, I would be more than satisfied if I could execute PHP function that would start synchronization?

Many thanks!

October 22, 2019 at 3:20 pm #4803765

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

I don't believe there is such a function that does that.
You can check the function function fix_translated_variations_relationships in woocommerce-multilingual\inc\class-wcml-troubleshooting.php to get inspired and build a function of your own.
This function is used in an AJAX call and checks for a nonce, I doubt we can use it directly from code.
But, I believe you can use some of its code. I suggest contacting one of our partners here https://wpml.org/contractors/

You can also ask for this feature in our page https://wpml.org/suggest-a-new-feature-for-wpml/

Let me know if you have any questions else.

Best regards,
Jamal