From 48fabea5b0e95a87d89982edbaa122f6d735cc2f Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 18 Apr 2016 15:21:26 +0100 Subject: [PATCH] Pass product object to wc_attribute_label Fixes #10692 --- includes/api/class-wc-api-products.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/api/class-wc-api-products.php b/includes/api/class-wc-api-products.php index 8e304e158bd..c8386be6753 100644 --- a/includes/api/class-wc-api-products.php +++ b/includes/api/class-wc-api-products.php @@ -2472,7 +2472,7 @@ class WC_API_Products extends WC_API_Resource { // taxonomy-based attributes are prefixed with `pa_`, otherwise simply `attribute_` $attributes[] = array( - 'name' => wc_attribute_label( str_replace( 'attribute_', '', $attribute_name ) ), + 'name' => wc_attribute_label( str_replace( 'attribute_', '', $attribute_name ), $product ), 'slug' => str_replace( 'attribute_', '', str_replace( 'pa_', '', $attribute_name ) ), 'option' => $attribute, ); @@ -2490,7 +2490,7 @@ class WC_API_Products extends WC_API_Resource { } $attributes[] = array( - 'name' => wc_attribute_label( $attribute['name'] ), + 'name' => wc_attribute_label( $attribute['name'], $product ), 'slug' => str_replace( 'pa_', '', $attribute['name'] ), 'position' => (int) $attribute['position'], 'visible' => (bool) $attribute['is_visible'],