WP_Query: Exclude hidden products from WooCommerce product list

Important: The following only works for WooCommerce versions less than 3.0. For a more up-to-date answer please see the other answer by kalle.

WooCommerce save this data as metadata so you’ll need to run a Meta Query against the name _visibility. Something like:

'meta_query' => array(
    array(
        'key'       => '_visibility',
        'value'     => 'hidden',
        'compare'   => '!=',
    )
)

This will pull all posts that do not have meta _visibility equal to hidden.

Leave a Comment