Common Issues and Recommended Fixes
General guidance
When working with product lists across multiple shops in a WordPress Multisite environment, one of the most common challenges is correctly selecting and accessing product data from the originating site. This typically requires switching context using the switch_to_blog() method, which can quickly become complex and error-prone if handled manually.
To simplify this process, two dedicated filters are available and documented at Loop the Global Cart Items. These filters handle blog context switching automatically and are specifically designed to be used while looping through cart items, ensuring accurate data retrieval and improved code stability across all connected shops.
Error in My Account When Viewing Orders
The My Account → Orders section is designed to display orders originating from all connected shops within the network. This means that a customer can log into their account on any shop and view their complete order history, regardless of which shop the order was placed on. While this provides a seamless user experience, it can introduce slight compatibility issues with certain themes.
If the active theme’s My Account Orders template is not prepared to handle orders coming from multiple shops, the Orders section may appear empty or trigger a fatal PHP error. A commonly reported error is:
Fatal error: Uncaught Error: Call to a member function get_item_count()
This issue usually occurs because the template assumes all orders belong to the current shop and does not properly switch context when rendering orders from other sites in the network. As a result, WooCommerce functions may attempt to access order data without the correct blog context, leading to missing data or runtime errors.
Fortunately, this problem does not require extensive customization or rewriting theme files from scratch. The solution involves a small ( 2 additional lines of code ) and safe adjustment to the My Orders template, ensuring the correct shop context is used when displaying each order. This allows WooCommerce to correctly retrieve order items, totals, and metadata, regardless of the originating shop.
A step-by-step explanation of the fix, including code examples and best practices, is available in the following documentation article:
Change my-account/orders template if order from other shops are not visible
Applying this fix ensures full compatibility, prevents errors, and restores a consistent and reliable My Account experience for customers across the entire shop network.