Remove unneeded empty "Unknown" code handling in Order Attribution (#46654)

* Remove empty "Unknown" handling.

This is because `get_origin_label` would return "Unknown" by default, and therefore empty($origin) would not be true.

If someone use a wc_order_attribution_origin_formatted_source filter to return '' as the formatted source, we should respect it anyway and we should not override it with "Unknown".

* Add changelog.
This commit is contained in:
Gan Eng Chin 2024-04-17 19:28:09 +08:00 committed by GitHub
parent 1fddbb1001
commit 6e78a1c6ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: tweak
Remove unneeded empty "Unknown" code handling in Order Attribution.

View File

@ -335,9 +335,6 @@ class OrderAttributionController implements RegisterHooksInterface {
$source_type = $order->get_meta( $this->get_meta_prefixed_field_name( 'source_type' ) );
$source = $order->get_meta( $this->get_meta_prefixed_field_name( 'utm_source' ) );
$origin = $this->get_origin_label( $source_type, $source );
if ( empty( $origin ) ) {
$origin = __( 'Unknown', 'woocommerce' );
}
echo esc_html( $origin );
}