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

    • Selecting the Checkout Type option – Single Checkout / Each Store February 25, 2025
    • Easy Multilingual and Multi-Currency WooCommerce Shop November 18, 2023
    • Why use WP Multi Domain for WooCommerce with default WordPress instance over MultiSite environment May 9, 2022

    Social Links

    @2025. All Rights Reserved

    Terms & Conditions | Privacy Policy

    Latest Articles

    • 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 ·
    17 Nov

    Manage Orders From All Your WooCommerce Shops in a Single Control Panel

    https://single-site.wpglobalcart.com/manage-all-your-woocommerce-orders-from-a-single-central-dashboard/

    #WooCommerce #WordPress #WPGlobalCart

    Reply on Twitter 1990407186384662843 Retweet on Twitter 1990407186384662843 Like on Twitter 1990407186384662843 Twitter 1990407186384662843
    nspcode Nsp Code @nspcode ·
    14 Jul

    QTranslate Synchronize – Seamless Multilingual Ordering in Advanced Post Types Order
    #WordPress #apto #woocommerce

    https://www.nsp-code.com/qtranslate-synchronize-seamless-multilingual-ordering-in-advanced-post-types-order/

    Reply on Twitter 1944683290755039470 Retweet on Twitter 1944683290755039470 Like on Twitter 1944683290755039470 Twitter 1944683290755039470
    Load More