I'm really new to php editing but I'm trying to learn. My woocommerce products that are set to "hidden" under catalog visibility are still showing up under search results. How do I keep hidden products out of my search results? I found this thread (WP_Query: Exclude hidden products from WooCommerce product list) and tried adding the below code mentioned at the bottom of the thread (I'm using Woocommerce 3.2.1) to my child theme's functions.php file. It gave me the white screen of death and this error:
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW).
<?php
/*
Code to remove hidden woocommerce products from being displayed in a site search
*/
'tax_query' => array(
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'exclude-from-catalog',
'operator' => 'NOT IN',
)
)
Appreciate help in what I'm doing wrong. Thanks!