Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide unnecessary order attribution details #44907

Merged
merged 3 commits into from Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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