Automattic\WooCommerce\Blocks\Utils
ProductCollectionUtils::get_query_vars()
Helper function that constructs a WP_Query args array from a Product Collection or global query.
Method of the class: ProductCollectionUtils{}
No Hooks.
Return
Array
. Returns the constructed WP_Query arguments.
Usage
$result = ProductCollectionUtils::get_query_vars( $block, $page );
- $block(WP_Block) (required)
- Block instance.
- $page(int) (required)
- Current query's page.
ProductCollectionUtils::get_query_vars() ProductCollectionUtils::get query vars code WC 9.4.2
public static function get_query_vars( $block, $page ) { if ( ! empty( $block->context['query'] ) && ! $block->context['query']['inherit'] ) { return build_query_vars_from_query_block( $block, $page ); } global $wp_query; return array_filter( $wp_query->query_vars ); }