How to get only specific products shown on WooCommerce shop site

Posted on

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.

Related Articles
This tutorial is mainly written to help enthusiasts in Kenya to setup their own web server with Digital Ocean and host a WordPress blog on Read more
Das erfolgreiche Zustellen von E-Mails, gerade im E-Commerce Bereich, ist extrem wichtig. Wichtig sind hierbei die korrekten DNS Einträge und Mailserver Einstellungen wenn man seine Read more
Using a real SMPT mail box will help a lot to have your WooCommerce E-Mails send to the customers INBOX instead of spam. To get Read more
In case you, for some reason, have troubles getting SSL certificates for your site in ISPConfig, then the reason for this problem is might not Read more
Expand the Storage for a client in ISPConfig, with Digital Ocean's Block Storage dynamically and within just a few minutes.
Leave a Comment / What do you think?

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