Merge remote-tracking branch 'woothemes/master'

This commit is contained in:
Job 2016-06-13 16:35:35 +02:00
commit 4f550b3ec8
1 changed files with 11 additions and 1 deletions

View File

@ -129,7 +129,6 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
// Map between taxonomy name and arg's key.
$taxonomies = array(
'product_type' => 'type',
'product_cat' => 'category',
'product_tag' => 'tag',
'product_shipping_class' => 'shipping_class',
@ -148,6 +147,17 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
}
}
// Filter product type by slug.
if ( ! empty( $request['type'] ) ) {
$terms = explode( ',', $request['type'] );
$tax_query[] = array(
'taxonomy' => 'product_type',
'field' => 'slug',
'terms' => $terms,
);
}
// Filter by attribute and term.
if ( ! empty( $request['attribute'] ) && ! empty( $request['attribute_term'] ) ) {
if ( in_array( $request['attribute'], wc_get_attribute_taxonomy_names() ) ) {