From 7c1d6b6d7ca376b7e8c54cfabdbe76e3baa7aaf1 Mon Sep 17 00:00:00 2001 From: Justin Palmer <228780+layoutd@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:44:56 +0100 Subject: [PATCH] Only display attribution meta boxes for valid orders --- plugins/woocommerce/src/Internal/Admin/Orders/Edit.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/woocommerce/src/Internal/Admin/Orders/Edit.php b/plugins/woocommerce/src/Internal/Admin/Orders/Edit.php index 429e1da7a72..69032d534ba 100644 --- a/plugins/woocommerce/src/Internal/Admin/Orders/Edit.php +++ b/plugins/woocommerce/src/Internal/Admin/Orders/Edit.php @@ -241,7 +241,9 @@ class Edit { sprintf( __( '%s information', 'woocommerce' ), $title ), function( $post_or_order ) use ( $source_attribution_meta_box ) { $order = $post_or_order instanceof WC_Order ? $post_or_order : wc_get_order( $post_or_order ); - $source_attribution_meta_box->output( $order ); + if ( $order instanceof WC_Order ) { + $source_attribution_meta_box->output( $order ); + } }, $screen_id, 'side', @@ -260,7 +262,9 @@ class Edit { __( 'Customer History', 'woocommerce' ), function( $post_or_order ) use ( $customer_history_meta_box ) { $order = $post_or_order instanceof WC_Order ? $post_or_order : wc_get_order( $post_or_order ); - $customer_history_meta_box->output( $order ); + if ( $order instanceof WC_Order ) { + $customer_history_meta_box->output( $order ); + } }, $screen_id, 'side',