Tweak logic responsible for registering COT admin list table.

This commit is contained in:
barryhughes 2022-05-05 19:21:56 +00:00
parent 8b30cf2639
commit 0ecffb416f
1 changed files with 7 additions and 4 deletions

View File

@ -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' );
}
}
/**