Search
Show product shop within order dashboard - WP Global Cart
14956
documentation-template-default,single,single-documentation,postid-14956,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
 

Show product shop within order dashboard

WP Global Cart / Show product shop within order dashboard
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page

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.

0
Would love your thoughts, please comment.x
()
x