WP Global Cart >
Send email notification to Shop Owner, if a product was checked-out on a different site
Send email notification to Shop Owner, if a product was checked-out on a different site
When using Single Site Check-out type, the Global Cart is being processed at a specified shop in the network or one at the customer preference. All Products will be included in a single order created on the site where the check-out occurs.
On shop Networks, where the owner chose to use Shop Managers to allow individual sites to be run by individual users, when a new Order is created on the Check-out Shop, a notification e-mail might be required to be sent to the shop where the product originated. A custom code can be used to achieve this functionality.
The following code should be placed in a file e.g. woo-gc-custom.php inside you /wp-content/mu-plugins folder. If the folder does not exist on your WordPress, you should create it manually.
add_action( 'woocommerce_checkout_update_order_meta', 'woogc_woocommerce_checkout_update_order_meta' );
function woogc_woocommerce_checkout_update_order_meta ( $order_id )
{
$subject = 'New Order';
$order = wc_get_order( $order_id );
foreach( $order->get_items() as $key => $order_item )
{
switch_to_blog( $order_item->get_meta('blog_id') );
$product_name = $order_item->get_name();
$product_id = $order_item->get_product_id();
$product_variation_id = $order_item->get_variation_id();
$message = "A new order has received which include a product from your shop: \n" . $product_name . " " . get_permalink($product_id);
$to = get_option('admin_email');
wp_mail( $to, $subject, $message );
restore_current_blog();
}
}
Related Posts
By default, on Product...
Name: woogc/ps/synchronize_product/child_product
Type: Filter
Arguments:
(object)$child_product
(array)$main_product_data
(int)$origin_product_blog_ID
This filter...
The WooCommerce Global Cart...
The Global Cart feature...
In the ever-evolving landscape of e-commerce, where seamless customer experiences are the cornerstone of success, WooCommerce Global Cart is now supporting the new WooCommerce Cart Blocks and Checkout Blocks, as powerful allies for merchants seeking to elevate their checkout processes. This groundbreaking integration seamlessly blends the benefits of Global Cart with the enhanced functionality of the new blocks, propelling businesses towards a paradigm shift in their online shopping journeys. Starting WooCommerce version 8.3 the Cart Blocks and Checkout Blocks are now the default checkout flow for new installations.
Name: woogc/ps/interfaces/sync_to_shop
Type: Filter
Arguments: $status, $remote_blog_id, $post
The...
Name: woogc/ps/synchronize_product/completed
Type: Filter
Arguments: $child_product_ID, $main_product_ID,...
Name: woogc/ps/interfaces/synchronize_to_sites
Type: Filter
Arguments: $sites
The filter...
When utilizing the Single...
WPGlobalCart is a powerful WooCommerce plugin designed to streamline e-commerce operations within a WordPress MultiSite network. It offers a range of tools and features that simplify product management, making it an essential tool for businesses with multiple online stores.
Product Synchronization Made Easy
One of the standout features of the WPGlobalCart plugin is its user-friendly and efficient approach to product synchronization. Managing a diverse range of products across multiple websites within a WordPress MultiSite network can be a complex and time-consuming task. However, WPGlobalCart streamlines this process, offering a set of tools and features that make product synchronization a breeze.