Ensure attributes exist
This commit is contained in:
parent
f683c29e66
commit
10190ab177
|
@ -511,7 +511,11 @@ class WC_Cart {
|
|||
} else {
|
||||
$value = apply_filters( 'woocommerce_variation_option_name', $value );
|
||||
$product_attributes = $cart_item['data']->get_attributes();
|
||||
$label = wc_attribute_label( $product_attributes[ str_replace( 'attribute_', '', urldecode( $name ) ) ]['name'] );
|
||||
if ( isset( $product_attributes[ str_replace( 'attribute_', '', urldecode( $name ) ) ] ) ) {
|
||||
$label = wc_attribute_label( $product_attributes[ str_replace( 'attribute_', '', urldecode( $name ) ) ]['name'] );
|
||||
} else {
|
||||
$label = $name;
|
||||
}
|
||||
}
|
||||
|
||||
$item_data[] = array(
|
||||
|
|
|
@ -61,7 +61,10 @@ class WC_Order_Item_Meta {
|
|||
// 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();
|
||||
$meta_key = wc_attribute_label( $product_attributes[ str_replace( 'attribute_', '', urldecode( $meta_key ) ) ]['name'] );
|
||||
|
||||
if ( isset( $product_attributes[ str_replace( 'attribute_', '', urldecode( $meta_key ) ) ] ) ) {
|
||||
$meta_key = wc_attribute_label( $product_attributes[ str_replace( 'attribute_', '', urldecode( $meta_key ) ) ]['name'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $flat )
|
||||
|
|
Loading…
Reference in New Issue