Move things around for performance

This commit is contained in:
Claudiu Lodromanean 2017-02-14 13:11:45 -08:00
parent 749971759f
commit 44af1237e5
1 changed files with 4 additions and 3 deletions

View File

@ -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 ) {