Pass product object to wc_attribute_label

Fixes #10692
This commit is contained in:
Mike Jolley 2016-04-18 15:21:26 +01:00
parent c5ccc65856
commit 48fabea5b0
1 changed files with 2 additions and 2 deletions

View File

@ -2472,7 +2472,7 @@ class WC_API_Products extends WC_API_Resource {
// taxonomy-based attributes are prefixed with `pa_`, otherwise simply `attribute_` // taxonomy-based attributes are prefixed with `pa_`, otherwise simply `attribute_`
$attributes[] = array( $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 ) ), 'slug' => str_replace( 'attribute_', '', str_replace( 'pa_', '', $attribute_name ) ),
'option' => $attribute, 'option' => $attribute,
); );
@ -2490,7 +2490,7 @@ class WC_API_Products extends WC_API_Resource {
} }
$attributes[] = array( $attributes[] = array(
'name' => wc_attribute_label( $attribute['name'] ), 'name' => wc_attribute_label( $attribute['name'], $product ),
'slug' => str_replace( 'pa_', '', $attribute['name'] ), 'slug' => str_replace( 'pa_', '', $attribute['name'] ),
'position' => (int) $attribute['position'], 'position' => (int) $attribute['position'],
'visible' => (bool) $attribute['is_visible'], 'visible' => (bool) $attribute['is_visible'],