WooCommerce Product Sync Pro uses the following action to monitor product changes:
woocommerce_after_product_object_save
This action has to be triggered in order for Product Sync Pro to detect product changes and synchronize them. The hook is automatically run by WooCommerce itself and most other 3rd party plugins. However, if you have developed a custom solution that updates products, make sure to trigger the action appropriately.
Code that won’t work:
function update_product_stock( $product, $stock_quantity ) {
update_post_meta( $product->get_id(), '_stock', $stock_quantity );
}
This code won’t work because it doesn’t trigger the action after it has updated the product.
Code that works:
function update_product_stock( $product, $stock_quantity ) {
update_post_meta( $product->get_id(), '_stock', $stock_quantity );
do_action( 'woocommerce_after_product_object_save', $product, false );
}
This will work because it triggers woocommerce_after_product_object_save
.