woogc/ps/synchronize_product/synchronize_product_data
Name: woogc/ps/synchronize_product/synchronize_product_data
Type: Action
Arguments: $prop_title, $prop_value, $child_product, $main_product_data, $origin_product_blog_ID
Arguments
Parameter | Type | Description |
$prop_title | string | The name of the product property currently being synchronized (e.g. price, description, custom meta key, etc.). |
$prop_value | mixed | The value of the property being synchronized. |
$child_product | WC_Product object | The WooCommerce product object on the child site that is being updated. |
$main_product_data | array | An associative array containing the full dataset of the origin product. Useful for syncing multiple fields. |
$origin_product_blog_ID | int | The blog ID of the origin product (source site). |
This hook is triggered on synchronizing custom product data for every product property and metadata, to perform custom actions when a product is being synced from the origin site to the child sites. Developers can use this hook to ensure custom fields, third-party plugin data, or specific business logic runs its own action and custom processing.
Below is an example of how you might use this action to further process when a custom meta field (_custom_shipping_time):
add_action( 'woogc/ps/synchronize_product/synchronize_product_data', 'my_sync_custom_shipping_time', 10, 5 ); function my_sync_custom_shipping_time( $prop_title, $prop_value, $child_product, $main_product_data, $origin_product_blog_ID ) { if ( $prop_title === '_custom_shipping_time' ) { // Assuming _custom_shipping_time is a meta field in the original product $child_product->update_meta_data( '_custom_shipping_time', $prop_value ); $child_product->save(); // Don't forget to save the product after updating } }