Background of the issue:
I have products updated through WordPress API in the original language. We use variations and hide products that are out of stock, with stock status coming from API sync. With the original language, everything is fine, but translated products are not updated automatically. To update translated products, I have to open WPML on the site admin panel, pause and start autotranslate, which syncs the translated product after some time. I am looking for a way to do this automatically without pressing a button every day and keeping the WP admin open. As a minimum, I need some code for functions.php to disable translated products when the original is gone, or any other way to solve the issue.
Symptoms:
Translated products and stock status are not updated automatically, resulting in unwanted out-of-stock translated products on the site.
Questions:
How can I set up automatic translation updates every day without manual intervention?
Can you provide code for functions.php to disable translated products when the original is out of stock or some better solution for the issue?
To achieve this, you must also use your API calls on the translated products. WooCommerce Multilingual is compatible with the WordPress REST API. Using the REST API, you can create, read, update, and delete translated WooCommerce content. Please read about it in our developer guide here.