Need to hide one or more products from your shop page loop? There’s 2 steps involved.
- The input value for true or false
- 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 :
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.
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.
Leave a Reply
You must be logged in to post a comment.