WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\BlockTypes

AbstractProductGrid::set_visibility_query_args() protected WC 1.0

Set visibility query args.

{} It's a method of the class: AbstractProductGrid{}

No Hooks.

Return

null. Nothing.

Usage

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

Code of AbstractProductGrid::set_visibility_query_args() WC 5.6.0

protected function set_visibility_query_args( &$query_args ) {
	$product_visibility_terms  = wc_get_product_visibility_term_ids();
	$product_visibility_not_in = array( $product_visibility_terms['exclude-from-catalog'] );

	if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) ) {
		$product_visibility_not_in[] = $product_visibility_terms['outofstock'];
	}

	$query_args['tax_query'][] = array(
		'taxonomy' => 'product_visibility',
		'field'    => 'term_taxonomy_id',
		'terms'    => $product_visibility_not_in,
		'operator' => 'NOT IN',
	);
}