Search
Code Example Archives - WP Global Cart
326
archive,tax-documentation_tag,term-code-example,term-326,theme-awake,eltd-core-1.1,woocommerce-no-js,awake child-child-ver-1.0.0,awake-ver-1.0,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-6.3.0,vc_responsive
 

Archive

Manually trigger an order synchronization operation

The WooCommerce Global Cart plugin streamlines order management by implementing a Global Order functionality, ensuring that orders are seamlessly physically synchronized across designated shops within your network. With synchronization occurring both during order creation and updates, businesses can maintain consistency and reduce manual workload. In cases where an order created prior to enabling the synchronization feature needs to be migrated to a different shop, a manual trigger through custom code offers a reliable solution. This targeted approach allows for flexibility...

View More

Include additional data within Split Orders

The Split function in the WooCommerce Global Cart plugin is a powerful feature that enables the division of a main order into separate orders across various shops containing products in the cart. This functionality is particularly beneficial in multi-vendor environments, ensuring each shop processes its respective products independently. The split engine's flexibility allows for programmatic extensions, primarily through the woogc/single_checkout/split_order/order_created filter. This filter is instrumental in customizing the behavior of split orders during their creation. By hooking into this filter,...

View More

Synchronizing Orders Across Shops in a WooCommerce Multisite Network with Global Cart

UPDATE: This feature has been integrated into the core of the plugin and can now be activated in the Settings. WooCommerce Global Cart is an indispensable tool for managing multisite networks, enabling a unified shopping experience across multiple stores. Synchronizing orders across the network may be a required feature for streamlined management and optimal customer service. Here, we delve into how order synchronization can be achieved, exploring the default options, the Network Orders interface, and how advanced users can implement...

View More

Remove Linked Products Automatically When Deleting a Main Product in WooCommerce

By default, WooCommerce retains synchronized products when a main product is deleted. However, you may want to change this behavior to automatically remove synchronized child products when the main product is deleted. This can be achieved by adding custom code to your site. Here’s how you can implement this functionality: add_action( 'before_delete_post', 'wogc_before_delete_post', 1, 2 ); /** * Remove synchronized child products when a main product is deleted. * * @param int $postid The ID of the product being deleted. * @param...

View More

Disabling Persistent Cart in WooCommerce while using the Global Cart

WooCommerce’s persistent cart feature is designed to save cart contents for logged-in users, enabling them to pick up where they left off. However, when using the WooCommerce Global Cart plugin, this functionality may not always be desirable. Specifically, persistent cart behavior can cause the user’s saved cart to merge with their existing global cart upon login. If your store relies on WooCommerce Global Cart to synchronize carts across multiple sites or sessions, disabling the persistent cart ensures a cleaner, more...

View More

woogc/sequential_order_number/format

Name: woogc/sequential_order_number/format Type: Filter Arguments: (int) $order_number, (int) $order_id The woogc/sequential_order_number/format filter in WooCommerce allows you to customize the format of the order number generated for new orders within the WooCommerce Global Cart. This filter can be used to modify the default sequential order number by prepending or appending custom prefixes, suffixes, or any other modifications to suit your business needs. Example Usage The following code example demonstrates how to customize the order number format by adding a custom prefix to the order number: ...

View More

woogc/global_cart/sites

Name: woogc/global_cart/sites Type: Filter Arguments: (array) $sites_ids The following code snippet demonstrates how to synchronize the current shop with only the designated checkout site. This selective synchronization is particularly useful when you want to minimize the number of shops involved in the network, ensuring that only the current site and the checkout site are synced. This approach optimizes performance and reduces unnecessary data transfer, focusing the synchronization process on the essential sites only. By utilizing the woogc/global_cart/sites filter, you can easily define which sites...

View More

Get the network Total Sales for a synchronized product

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

woogc/ps/interfaces/sync_to_shop

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

woogc/ps/interfaces/synchronize_to_sites

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