From 367e16ffa9637548d457ca1aae07abf9ad1322b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=BCsken?= Date: Thu, 8 Sep 2016 14:13:39 +0200 Subject: [PATCH] API Variation returns sanitize attribute names #11868 --- includes/api/class-wc-rest-products-controller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/api/class-wc-rest-products-controller.php b/includes/api/class-wc-rest-products-controller.php index faca353871c..4d626464c69 100644 --- a/includes/api/class-wc-rest-products-controller.php +++ b/includes/api/class-wc-rest-products-controller.php @@ -398,10 +398,11 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller { // Taxonomy-based attributes are prefixed with `pa_`, otherwise simply `attribute_`. if ( 0 === strpos( $attribute_name, 'attribute_pa_' ) ) { + $option_term = get_term_by( 'slug', $attribute, $name ); $attributes[] = array( 'id' => wc_attribute_taxonomy_id_by_name( $name ), 'name' => $this->get_attribute_taxonomy_label( $name ), - 'option' => $attribute, + 'option' => $option_term->name, ); } else { $attributes[] = array(