woogc/ps/synchronize_product/completed
Name: woogc/ps/synchronize_product/completed
Type: Filter
Arguments: $child_product_ID, $main_product_ID, $child_product_blog_ID
The filter can be employed to execute additional actions upon the completion of a Product synchronization procedure
The provided code example synchronizes the product author as well. This my be helpful for plugins like the Dokan vendors and certain scenarios.
By default, this attribute remains unchanged during product synchronization to maintain consistency across authors/vendors in different shops.
add_action( 'woogc/ps/synchronize_product/completed', 'woogc_ps_synchronize_product_completed', 10, 3 ); function woogc_ps_synchronize_product_completed( $child_product_ID, $main_product_ID, $child_product_blog_ID ) { $product_post = get_post( $main_product_ID ); switch_to_blog( $child_product_blog_ID ); $args = array( 'ID' => $child_product_ID, 'post_author' => $product_post->post_author, ); wp_update_post( $args ); restore_current_blog(); }
The code should be placed inside a php file on wp-content/mu-plugins folder.