WC_Brands::rest_api_filter_products_by_brand()
Filters products by taxonomy product_brand.
Метод класса: WC_Brands{}
Хуков нет.
Возвращает
Массив
. Request args.
Использование
$WC_Brands = new WC_Brands(); $WC_Brands->rest_api_filter_products_by_brand( $args, $request );
- $args(массив) (обязательный)
- Request args.
- $request(WP_REST_Request) (обязательный)
- Request data.
Код WC_Brands::rest_api_filter_products_by_brand() WC Brands::rest api filter products by brand WC 9.4.2
public function rest_api_filter_products_by_brand( $args, $request ) { if ( ! empty( $request['brand'] ) ) { $args['tax_query'][] = array( 'taxonomy' => 'product_brand', 'field' => 'term_id', 'terms' => $request['brand'], ); } return $args; }