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'],