Skip to content

Commit

Permalink
Hide unnecessary order attribution details (#44907)
Browse files Browse the repository at this point in the history
* Hide more details for simple sources
  • Loading branch information
layoutd authored and Konamiman committed Mar 13, 2024
1 parent ce29659 commit c2d8a87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
@@ -0,0 +1,4 @@
Significance: minor
Type: update

Hide more details toggle for simple source types – direct, web admin, mobile app.
Expand Up @@ -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 );
}
Expand Down

0 comments on commit c2d8a87

Please sign in to comment.