Search
woogc/ps/synchronize_product/synchronize_product_data - WP Global Cart
17724
wp-singular,documentation-template-default,single,single-documentation,postid-17724,wp-theme-awake,wp-child-theme-awake-child,theme-awake,eltd-core-1.1,woocommerce-no-js,awake child-child-ver-1.0.0,awake-ver-1.8,eltd-smooth-scroll,eltd-smooth-page-transitions,eltd-mimic-ajax,eltd-grid-1200,eltd-blog-installed,eltd-default-style,eltd-fade-push-text-top,eltd-header-standard,eltd-sticky-header-on-scroll-down-up,eltd-default-mobile-header,eltd-sticky-up-mobile-header,eltd-menu-item-first-level-bg-color,eltd-dropdown-slide-from-top,eltd-,eltd-fullscreen-search eltd-search-fade,eltd-side-menu-slide-from-right,wpb-js-composer js-comp-ver-8.1,vc_responsive
 

woogc/ps/synchronize_product/synchronize_product_data

WP Global Cart / woogc/ps/synchronize_product/synchronize_product_data
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page

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
    }
}

0
Would love your thoughts, please comment.x
()
x