How to remove meta-boxes From WooCommerce Order edit pages when HPOS is enabled

How to remove specific order meta-boxes from order edit pages. The following works on legacy orders, but not with High-Performance Order Storage (HPOS): remove_meta_box( 'woocommerce-order-items', 'shop-order', 'normal' ); // Removes products/items meta box for technicians remove_meta_box( 'woocommerce-order-actions', 'shop-order', 'normal' ); // Removes products/items meta box for technicians remove_meta_box( 'woocommerce-order-notes', 'shop-order', 'normal' ); // Removes order note meta box for technicians remove_meta_box( 'order_custom', 'shop-order', 'normal' ); EDIT: I tried the following: function itsm_add_meta_boxes() { echo '<style> #woocommerce-order-items, #woocommerce-order-actions, #wpo_wcpdf-data-input-box, #woocommerce-order-notes, #order_custom { display: none !important; } </style>'; } add_action( 'add_meta_boxes', 'itsm_add_meta_boxes', 11 ); It just hide them, but does not actually remove them. Any other suggestions?

Comment (1)

Jese Leos

August 29, 2024

Verified user

For High-Performance Order Storage Metaboxes removal (compatible with legacy orders too), you need to use something a bit different as "shop-order" 2nd argument only works for legacy orders. Note that by default in WooCommerce, Order actions and Order notes 3rd argument is "side" (but not "normal"). Try the following: use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController; add_action( 'add_meta_boxes', 'admin_order_custom_metabox' ); function admin_order_custom_metabox() { $screen = class_exists( '\Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' ) && wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled() ? wc_get_page_screen_id( 'shop-order' ) : 'shop_order'; remove_meta_box( 'woocommerce-order-items', $screen, 'normal' ); // Removes Order items meta box remove_meta_box( 'woocommerce-order-actions', $screen, 'side' ); // Removes products/items meta box remove_meta_box( 'woocommerce-order-notes', $screen, 'side' ); // Removes order note meta box remove_meta_box( 'order_custom', $screen, 'normal' ); // Removes Custom fields meta box } Code goes in functions.php file of your child theme (or in a plugin). Tested and works. If you have changed manually some metaboxes location via drag and drop, you will need to adjust the 3rd argument to "normal" or "side".

You’ll be in good company