How to get only specific products shown on WooCommerce shop site

So I recently was doing a job for a client who wanted to have a WooCommerce shop. He has had some products and didn’t want to have them all on the main WooCommerce Shop page.

Digging around in the web has shown many suggestions with editing the functions.php to either deny a certain group of products or to exclude and so on and on. And I guess when you made it to my site, you want to see a working solution. So it was actually quite easy.

I assume you already have a main shop site but you don’t want all products to appear there.  So what you want to do, is to simply create another site called shop. It will give it the url shop-2. Then you want to go to WooCommerce => Settings => Products => Display and there you change the Shop-Site to the just created shop-2 site.

Next you login to your host via FTP, open the .htaccess file and add there this line:

RedirectMatch 301 /shop-2/(.*) /shop/$1

The next thing you want to do, is to get the ID’s of your products you want to show up at the shop site and add this shortcode to the old /shop/

[products ids="1, 2, 3, 4, 5"]

Check out the shop site. Only these Products are showing up.

Doing it this way will actually keep your shop-site with all products intact, but it wont be visible because everything that opens /shop-2/ (which is the systems shop site now, will be redirected to /shop/ – your custom shop site. And plus benefit – you don’t need to modify your theme.

Leave a Reply

Your email address will not be published. Required fields are marked *

*