Automattic\WooCommerce\Blocks\BlockTypes

ProductQuery::update_rest_query()publicWC 1.0

Update the query for the product query block in Editor.

Метод класса: ProductQuery{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$ProductQuery = new ProductQuery();
$ProductQuery->update_rest_query( $args, $request );
$args(массив) (обязательный)
Query args.
$request(WP_REST_Request) (обязательный)
Request.

Код ProductQuery::update_rest_query() WC 7.3.0

public function update_rest_query( $args, $request ) {
	$orderby          = $request->get_param( 'orderby' );
	$woo_attributes   = $request->get_param( '__woocommerceAttributes' );
	$woo_stock_status = $request->get_param( '__woocommerceStockStatus' );
	$on_sale_query    = $request->get_param( '__woocommerceOnSale' ) === 'true' ? $this->get_on_sale_products_query() : array();
	$orderby_query    = isset( $orderby ) ? $this->get_custom_orderby_query( $orderby ) : array();
	$attributes_query = is_array( $woo_attributes ) ? $this->get_product_attributes_query( $woo_attributes ) : array();
	$stock_query      = is_array( $woo_stock_status ) ? $this->get_stock_status_query( $woo_stock_status ) : array();

	return array_merge( $args, $on_sale_query, $orderby_query, $attributes_query, $stock_query );
}