Remove Single Products From Shop Page Loop – WooCommerce

Need to hide one or more products from your shop page loop? There’s 2 steps involved.

  1. The input value for true or false
  2. Code to modify the default shop loop query

STEP 1 : There’s at least 3 ways to deal with the input.

1. You can use the default WordPress custom field meta box located on every Edit screen with the exclude_product custom field key and a value of 1 like this :

WordPress Custom Field Exclude Product Shop Page Loop

2. You can use a custom field plugin like ACF and import this json file to create a switch which displays on your Edit Product screen and looks like this :

3. You can hand code a meta box using the WooCommerce Meta Box Functions API which looks like this :

STEP 2 : Then there’s PHP code you need to modify the default shop page loop.

Download Folder

Installation

There’s only 1 step : Copy & paste the PHP code to the end of your child themes functions file or custom functionality plugin.

Note : There’s 3 code snippets in the download folder. If you’re using ACF or WordPress custom fields, only use the 3rd snippet. If you want to add the custom checkbox to the product Data section, use all 3 snippets.

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.