diff --git a/plugins/woocommerce/changelog/tweak-hide-unnecesary-order-attribution-details b/plugins/woocommerce/changelog/tweak-hide-unnecesary-order-attribution-details new file mode 100644 index 000000000000..7055d27ef5c8 --- /dev/null +++ b/plugins/woocommerce/changelog/tweak-hide-unnecesary-order-attribution-details @@ -0,0 +1,4 @@ +Significance: minor +Type: update + +Hide more details toggle for simple source types – direct, web admin, mobile app. diff --git a/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/OrderAttribution.php b/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/OrderAttribution.php index a001f8b29fa0..ce8b4e2e3564 100644 --- a/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/OrderAttribution.php +++ b/plugins/woocommerce/src/Internal/Admin/Orders/MetaBoxes/OrderAttribution.php @@ -74,10 +74,18 @@ public function output( WC_Order $order ) { $this->format_meta_data( $meta ); + // No more details if there is only the origin value - this is for unknown source types. + $has_more_details = array( 'origin' ) !== array_keys( $meta ); + + // For direct, web admin, or mobile app orders, also don't show more details. + $simple_sources = array( 'typein', 'admin', 'mobile_app' ); + if ( isset( $meta['source_type'] ) && in_array( $meta['source_type'], $simple_sources, true ) ) { + $has_more_details = false; + } + $template_data = array( 'meta' => $meta, - // Only show more details toggle if there is more than just the origin. - 'has_more_details' => array( 'origin' ) !== array_keys( $meta ), + 'has_more_details' => $has_more_details, ); wc_get_template( 'order/attribution-details.php', $template_data ); }