Change my-account/orders template if order from other shops are not visible
As default the orders of a customer should be available and visible on front side, within My Account at Orders section. It happens for certain orders to be ignored since the theme is not aware of orders being available across whole network. The default template file is located at woocommerce/myaccount/orders.php within your theme. If the file does not exist we recommend to copy over from woocommerce plugin.
The template file contain the following:
foreach ( $customer_orders->orders as $customer_order ) { $order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $item_count = $order->get_item_count() - $order->get_item_count_refunded(); ?> <tr class="woocommerce-orders-table__row woocommerce-orders-table__row--status-<?php echo esc_attr( $order->get_status() ); ?> order"> <?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?> ... more code ... <?php endforeach; ?> </tr> <?php }
This need a bit of update to include the switch_to_blog() and restore_current_blog() so add the 2 new lines:
foreach ( $customer_orders->orders as $customer_order ) { if ( isset ( $customer_order->blog_id ) ) switch_to_blog($customer_order->blog_id); $order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $item_count = $order->get_item_count() - $order->get_item_count_refunded(); ?> <tr class="woocommerce-orders-table__row woocommerce-orders-table__row--status-<?php echo esc_attr( $order->get_status() ); ?> order"> <?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?> ... more code ... <?php endforeach; ?> </tr> <?php if ( isset ( $customer_order->blog_id ) ) restore_current_blog(); }
At his point, All orders from any shops will be included everywhere in-network at My Account > Orders section.