WPCommerce MultiDomain WPCommerce MultiDomain
  • 0
    • No products in the cart.
    • Home
    • Features
    • Pricing
    • Documentation
    • FAQ
    • Articles
    • Contact
    • My account
    WPCommerce MultiDomain WPCommerce MultiDomain
  • 0
    • No products in the cart.
    • Home
    • Features
    • Pricing
    • Documentation
    • FAQ
    • Articles
    • Contact
    • My account
    WPCommerce MultiDomain

    Documentation

    Hiding blog_id in WooMultiDomain Order Details

    When WooCommerce records order items it often stores extra metadata that helps identify where a product came from, how it was configured, or which internal system created it. One of those hidden-but-useful fields you may see on the order item page is blog_id — a small numeric value that identifies the origin site for that product when you run a multi-domain or multisite setup.

    If you use the WPCommerce WooMultiDomain solution, the blog_id becomes meaningful: it holds the product’s origin blog/site ID inside the multisite or multi-domain network. That means every order line can carry a direct reference to the exact site where the product record lives, which simplifies reconciliation, inventory tracing, and any cross-site fulfillment logic.

    Be mindful that blog_id is an internal identifier: it’s best used in administrative views and developer tools rather than shown to customers. When monitoring multi-domain stores, keeping the blog_id visible in admin order items speeds debugging and makes multi-site commerce workflows much easier to manage.

    To hide the blog_id meta field, a custom code can be used. The following code example can be added within theme functions.php or a custom file in /mu-plugins/ folder.

        /**
        * Remove 'blog_id' from formatted order item meta shown in admin/emails/frontend.
        *
        * @param array            $formatted_meta Array of formatted meta objects/arrays.
        * @param WC_Abstract_Item $item           The order item object.
        * @return array Modified $formatted_meta without 'blog_id' entries.
        */
        function hide_order_item_blog_id_meta( $formatted_meta, $item ) 
            {
                foreach ( $formatted_meta as $index => $meta ) 
                    {
                        // Support both object and array shaped meta entries (defensive)
                        if ( is_object( $meta ) ) {
                            $key = isset( $meta->key ) ? $meta->key : ( isset( $meta->display_key ) ? $meta->display_key : '' );
                        } elseif ( is_array( $meta ) ) {
                            $key = isset( $meta['key'] ) ? $meta['key'] : ( isset( $meta['display_key'] ) ? $meta['display_key'] : '' );
                        } else {
                            $key = '';
                        }
    
                        if ( '' !== $key && strtolower( $key ) === 'blog_id' ) {
                            unset( $formatted_meta[ $index ] );
                        }
                    }
    
                // Reindex numeric keys and return
                return array_values( $formatted_meta );
            }
        add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'hide_order_item_blog_id_meta', 10, 2 );
    

    Leave a Reply Cancel reply

    Recent Posts

    • How Customers Shop Across Multiple Domains March 19, 2026
    • Selecting the Checkout Type option – Single Checkout / Each Store February 25, 2025
    • Easy Multilingual and Multi-Currency WooCommerce Shop November 18, 2023

    Social Links

    @2026. All Rights Reserved

    Terms & Conditions | Privacy Policy

    Latest Articles

    • How Customers Shop Across Multiple Domains
      WooMultiDomain is built for stores that want one WooCommerce product list to serve multiple domains...
    • Selecting the Checkout Type option – Single Checkout / Each Store
      The WordPress WPCommerce Multi-Domain plugin includes powerful global shopping cart functionality, allowing customers to add...
    • Easy Multilingual and Multi-Currency WooCommerce Shop
      Using the WooCommerce Multi Domain, managing the WooCommerce Products has never been easier. Multiple Domains...
    • Why use WP Multi Domain for WooCommerce with default WordPress instance over MultiSite environment
      Creating a centralised network of shops isn’t a straightforward implementation. That requires a lot of...

    Nsp Code Follow

    Nsp-Code official Twitter account

    nspcode
    nspcode Nsp Code @nspcode ·
    27 Feb

    Software License for WooCommerce - Implement Discount Pricing for Expiring Products

    #woocommerce #woosoftwarelicense #softarelicense

    Reply on Twitter 2027313354339913789 Retweet on Twitter 2027313354339913789 Like on Twitter 2027313354339913789 Twitter 2027313354339913789
    nspcode Nsp Code @nspcode ·
    19 Jan

    How to Synchronize Product Brands Across the Shops in the network
    #WooCommerce #GlobalCart

    Reply on Twitter 2013262939466191241 Retweet on Twitter 2013262939466191241 Like on Twitter 2013262939466191241 Twitter 2013262939466191241
    Load More