From 0ecffb416f75bd743cf7283806b3e8f8991fab55 Mon Sep 17 00:00:00 2001 From: barryhughes <3594411+barryhughes@users.noreply.github.com> Date: Thu, 5 May 2022 19:21:56 +0000 Subject: [PATCH] Tweak logic responsible for registering COT admin list table. --- .../includes/admin/class-wc-admin-menus.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-menus.php b/plugins/woocommerce/includes/admin/class-wc-admin-menus.php index 50350ac28e4..f93d524f39a 100644 --- a/plugins/woocommerce/includes/admin/class-wc-admin-menus.php +++ b/plugins/woocommerce/includes/admin/class-wc-admin-menus.php @@ -8,6 +8,7 @@ use Automattic\WooCommerce\Admin\Features\Navigation\Screen; use Automattic\WooCommerce\Internal\Admin\Orders\ListTable as Custom_Orders_List_Table; +use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController; defined( 'ABSPATH' ) || exit; @@ -310,14 +311,16 @@ class WC_Admin_Menus { } /** - * Link to the oder admin list table from the main WooCommerce menu. + * Link to the order admin list table from the main WooCommerce menu. * * @return void */ public function orders_menu(): void { - add_submenu_page( 'woocommerce', __( 'Orders', 'woocommerce' ), __( 'Orders', 'woocommerce' ), 'edit_others_shop_orders', 'wc-orders', array( $this, 'orders_page' ) ); - add_filter( 'manage_woocommerce_page_wc-orders_columns', array( $this, 'orders_table' ) ); - Screen::add_screen( 'wc-orders', 'woocommerce' ); + if ( wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled() ) { + add_submenu_page( 'woocommerce', __( 'Orders', 'woocommerce' ), __( 'Orders', 'woocommerce' ), 'edit_others_shop_orders', 'wc-orders', array( $this, 'orders_page' ) ); + add_filter( 'manage_woocommerce_page_wc-orders_columns', array( $this, 'orders_table' ) ); + Screen::add_screen( 'wc-orders', 'woocommerce' ); + } } /**