From 3ebd22b64a297b89d84b95a32b52326843fb1875 Mon Sep 17 00:00:00 2001 From: Tamara Zuk Date: Sun, 11 May 2014 09:37:27 -0400 Subject: [PATCH] Check if term is returned before getting its name Prevents a rare notice if the order item meta value is blank --- includes/class-wc-order-item-meta.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/class-wc-order-item-meta.php b/includes/class-wc-order-item-meta.php index dee65d6ef67..1c1fff94b11 100644 --- a/includes/class-wc-order-item-meta.php +++ b/includes/class-wc-order-item-meta.php @@ -59,11 +59,11 @@ class WC_Order_Item_Meta { // If this is a term slug, get the term's nice name if ( taxonomy_exists( $attribute_key ) ) { $term = get_term_by( 'slug', $meta_value, $attribute_key ); - - if ( ! is_wp_error( $term ) && $term->name ) { + + if ( ! is_wp_error( $term ) && is_object( $term ) && $term->name ) { $meta_value = $term->name; } - + // If we have a product, and its not a term, try to find its non-sanitized name } elseif ( $this->product ) { $product_attributes = $this->product->get_attributes(); @@ -102,7 +102,7 @@ class WC_Order_Item_Meta { else echo $output; } - + return ''; } } \ No newline at end of file