|
Hello,
I am experiencing a stock synchronization issue between the original product (Italian) and its translation (German) in WooCommerce when stock updates are performed through an external connector.
Site setup:
WordPress + WooCommerce
WPML + WooCommerce Multilingual
Products translated IT → DE
Stock managed at variation level
External connector: BindCommerce (inventory synchronization)
Problem description:
When stock quantities are updated through BindCommerce, the Italian product updates correctly, but the translated German product does not receive the updated stock values.
However, if I open the Italian product in WooCommerce and simply click Update (without changing anything), WPML immediately synchronizes the stock and the German product becomes aligned.
So the synchronization works when the product is saved in WordPress, but not when stock is updated through the external connector.
Technical verification already performed:
BindCommerce correctly updates the WooCommerce database.
The stock value _stock is updated directly in the database table wp_postmeta for the variation.
Example query used to verify:
SELECT post_id, meta_key, meta_value
FROM wp_postmeta
WHERE post_id = VARIATION_ID
AND meta_key IN ('_stock','_stock_status','_manage_stock');
The _stock value changes correctly after the external update.
Therefore the problem is not the database update itself.
It seems that when the connector writes the stock value in the database, WPML synchronization for translated products is not triggered.
Additional observations:
Running WPML → Troubleshooting → Sync product stock quantity and status does not fix the mismatch.
Running Sync product variations also does not correct the issue.
The translated variation exists correctly and is properly linked.
Stock fields in Custom Fields Translation were tested with both:
_stock = Copy
_stock = Don't translate
The behavior remains the same.
Key evidence:
If I manually click Update on the original product in WooCommerce:
WPML immediately synchronizes the stock
the German translation becomes correct.
Question:
Is there a known limitation or configuration required for stock updates that come from external scripts / API / connectors which update _stock directly in the database?
Does WPML require a specific hook or function (for example woocommerce_product_set_stock or similar) to trigger the synchronization of translated products?
Is there a recommended method or snippet to ensure stock updates from external integrations correctly propagate to translated products?
Any guidance would be greatly appreciated.
Thank you.
|