Show product shop within order dashboard
When Check-out being set as Single Checkout the Order include all products in the cart, even if they are coming from different shops. To make easy to identify which product is coming from what shop, a small piece of code can be used.
add_action('woocommerce_before_order_itemmeta', 'custom_woocommerce_before_order_itemmeta', 99, 3);
function custom_woocommerce_before_order_itemmeta( $item_id, $item, $product )
{
$meta_blog_id = $item->get_meta('blog_id');
if ( empty ( $meta_blog_id ) )
return;
$site_data = get_blog_details( $meta_blog_id );
?>
Shop <a href="<?php echo $site_data->siteurl ?>"><?php echo $site_data->blogname ?></a>
<?php
}
The results appear like this:
The above code should be placed inside a custom plugin or within mu-plugins.
Related Posts
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/sequential_order_number/format
Type: Filter
Arguments: (int) $order_number,...
Name: woogc/global_cart/sites
Type: Filter
Arguments: (array) $sites_ids
The...
Name: woogc/single_checkout/split_order/order_created
Type: Action
Arguments: $new_order
The `woogc/single_checkout/split_order/order_created` action...
The WordPress WooCommerce Global...
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...
Name: woogc/ps/interfaces/sync_to_shop
Type: Filter
Arguments: $status, $remote_blog_id, $post
The...