diff --git a/includes/class-wc-order-item.php b/includes/class-wc-order-item.php index 4d475020861..1adf7f48b36 100644 --- a/includes/class-wc-order-item.php +++ b/includes/class-wc-order-item.php @@ -193,9 +193,6 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { $meta->key = rawurldecode( (string) $meta->key ); $meta->value = rawurldecode( (string) $meta->value ); - $attribute_key = str_replace( 'attribute_', '', $meta->key ); - $display_key = wc_attribute_label( $attribute_key, $product ); - $display_value = $meta->value; // Skip items with values already in the product details area of the product name $value_in_product_name_regex = "/–.*{$meta->value}/i"; @@ -203,6 +200,10 @@ class WC_Order_Item extends WC_Data implements ArrayAccess { continue; } + $attribute_key = str_replace( 'attribute_', '', $meta->key ); + $display_key = wc_attribute_label( $attribute_key, $product ); + $display_value = $meta->value; + if ( taxonomy_exists( $attribute_key ) ) { $term = get_term_by( 'slug', $meta->value, $attribute_key ); if ( ! is_wp_error( $term ) && is_object( $term ) && $term->name ) {