WC_Shortcode_Products::set_visibility_featured_query_args()protectedWC 3.2.0

Set visibility as featured.

Method of the class: WC_Shortcode_Products{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->set_visibility_featured_query_args( $query_args );
$query_args(array) (required) (passed by reference — &)
Query args.

Changelog

Since 3.2.0 Introduced.

WC_Shortcode_Products::set_visibility_featured_query_args() code WC 9.4.2

protected function set_visibility_featured_query_args( &$query_args ) {
	$query_args['tax_query'] = array_merge( $query_args['tax_query'], WC()->query->get_tax_query() ); // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query

	$query_args['tax_query'][] = array(
		'taxonomy'         => 'product_visibility',
		'terms'            => 'featured',
		'field'            => 'name',
		'operator'         => 'IN',
		'include_children' => false,
	);
}