Merge remote-tracking branch 'woothemes/master'
This commit is contained in:
commit
4f550b3ec8
|
@ -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() ) ) {
|
||||
|
|
Loading…
Reference in New Issue