Managing multiple WooCommerce shops within a WordPress Multisite environment can be challenging, especially when it comes to keeping product information consistent across all stores. The WooCommerce Product Synchronization feature in the WP Global Cart plugin addresses this challenge by enabling seamless synchronization of products across your network.
Name: woogc/ps/synchronize_product/child_product
Type: Filter
Arguments:
(object)$child_product
(array)$main_product_data
(int)$origin_product_blog_ID
This filter is utilized within the WooCommerce Global Cart plugin to enable modifications to the child product object before it's returned to the core and saved. It provides developers with the ability to customize the child product data as needed during the synchronization process.
add_filter( 'woogc/ps/synchronize_product/child_product', 'custom_modify_child_product', 10, 3 );
function custom_modify_child_product( $child_product, $main_product_data, $origin_product_blog_ID ) {
// Perform modifications to $child_product here
// Example: Change the price of the child product
...
View More
The WooCommerce Global Cart offers a powerful solution for businesses operating multiple online stores within a WordPress Multisite network. By synchronizing products across these shops, merchants can ensure consistency in product offerings while simplifying inventory management. However, one challenge that arises with this setup is the need to accurately track sales for synchronized products across the entire network.
To address this challenge, developers can implement custom functions to retrieve essential data, such as the total number of network sales for...
View More
Name: woogc/ps/interfaces/sync_to_shop
Type: Filter
Arguments: $status, $remote_blog_id, $post
The filter can be used to change the synchronization interface button status from active to inactive or vice versa.
For example, when creating a new product, the buttons will show up active as default:
add_filter ( 'woogc/ps/interfaces/sync_to_shop', 'woogc_ps_interfaces_option_status', 10, 3 );
add_filter ( 'woogc/ps/interfaces/maintain_child', 'woogc_ps_interfaces_option_status', 10, 3 );
add_filter ( 'woogc/ps/interfaces/maintain_categories', 'woogc_ps_interfaces_option_status',...
View More
Name: woogc/ps/interfaces/synchronize_to_sites
Type: Filter
Arguments: $sites
The filter allows you to regulate the shops that are accessible within the Synchronization Interface, determining where the feature is available.
The following example check if the edit page is for product ID 33 and 44. If match, it disable the synchronization option to the Shop ID 2:
add_filter ( 'woogc/ps/interfaces/synchronize_to_sites', 'woogc_ps_interfaces_synchronize_to_sites' );
function woogc_ps_interfaces_synchronize_to_sites( $sites )
{
...
View More
Name: woogc/ps/synchronize_product/ignore_meta_key
Type: Filter
Arguments: $IgnoreMeta, $prop_title, $prop_value, $child_product, $main_product_data, $origin_product_blog_ID
The filter can be used to ignore/skip a meta field to replicate, when running a Product synchronization procedure.
The following example ignores any parent Product Title change
add_filter ( 'woogc/ps/synchronize_product/ignore_meta_key', 'woogc_ps_synchronize_product_ignore_meta_key', 10, 6 );
function woogc_ps_synchronize_product_ignore_meta_key ( $ignore, $prop_title, $prop_value, $child_product, $main_product_data, $origin_product_blog_ID )
{
if ( $prop_title...
View More
The Synchronization procedure is the way the plugin core ensures the data is processed unitary across the network, for the selected shops.
The plugin automatically deploys any of the selected synchronization types, by making the required adjustments to your WordPress environment. When completed, all server caches ( including the site ) are required to clear manually, for the new settings to take effect. If applied, the CDN cache should be cleared as well.
Mainly the procedure consists of setting up...
View More