Automattic\WooCommerce\Blocks\BlockTypes

AbstractProductGrid::parse_query_args()protectedWC 1.0

Parse query args.

Method of the class: AbstractProductGrid{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->parse_query_args();

AbstractProductGrid::parse_query_args() code WC 9.4.2

protected function parse_query_args() {
	// Store the original meta query.
	$this->meta_query = WC()->query->get_meta_query();

	$query_args = array(
		'post_type'           => 'product',
		'post_status'         => 'publish',
		'fields'              => 'ids',
		'ignore_sticky_posts' => true,
		'no_found_rows'       => false,
		'orderby'             => '',
		'order'               => '',
		'meta_query'          => $this->meta_query, // phpcs:ignore WordPress.DB.SlowDBQuery
		'tax_query'           => array(), // phpcs:ignore WordPress.DB.SlowDBQuery
		'posts_per_page'      => $this->get_products_limit(),
	);

	$this->set_block_query_args( $query_args );
	$this->set_ordering_query_args( $query_args );
	$this->set_categories_query_args( $query_args );
	$this->set_visibility_query_args( $query_args );
	$this->set_stock_status_query_args( $query_args );

	return $query_args;
}