WooCommerce

How to Hide Products in WooCommerce and Show Them Only to Certain Customers or Roles

Private Products for WooCommerce makes the products you choose (all, by category, by tag, or one by one) private so that only the users and roles you authorize can see and purchase them. Ideal for wholesale catalogs, B2B, private stores, and prices for specific customers.

JC Jose Conti 6 min read
Tienda online con un catálogo privado que solo ven algunos clientes, mientras los demás visitantes encuentran la puerta cerrada

To hide products in WooCommerce and show them only to some customers, install Private Products for WooCommerce, mark the products you want as private (all, those from certain categories or tags, or one by one) and choose which users or roles can see them. The rest of the visitors receive a 404 page or go to the page you specify, cannot purchase them, and cannot find them in the store, in search, in the API, or in Google.

I developed it, José Conti, since 2018, and version 1.3 is the most complete and secure so far.

What problem it solves

WooCommerce does not provide a way to say 'only these customers can see this product.' The options it offers (catalog visibility, password, or private status) either hide it from everyone or do not prevent someone from accessing it with the link, finding it through the API, or adding it to the cart. Private Products controls who can see and buy each product, based on the user or their role, and applies that rule across all sites where WordPress and WooCommerce display products.

For what stores it is suitable

  • B2B and wholesale stores: a catalog for distributors that only the 'wholesaler' role sees, alongside the normal store.
  • Clubs, associations, and schools: products, fees, or materials only for members or students.
  • Products for a specific customer: a quote, a custom order, or a special price that only that person sees.
  • Private stores: the entire store closed so that only the registered users you authorize can purchase, for example, the internal store of a company.
  • Launches and pre-sales: products that only a group of customers sees before opening them to everyone.

How it works

  1. Activate the plugin and go to WooCommerce › Settings › Products › Private Products.
  2. Choose what is private: the entire store, products from certain categories or tags, or individual products from the 'Private Product' tab of each product.
  3. Choose who can see them: specific users (searched by name or email) and user roles, globally or product by product.
  4. Decide what those without permission see: a normal 404 page, which does not reveal that the product exists, or a page of your own, for example, 'This catalog is for registered wholesale customers.'
  5. If you want, hide private products from the store, categories, search, and blocks, or leave them visible as a showcase: when opened, those without permission receive the 404 or redirection.

What it includes

  • Private products by category, by tag, one by one, or the entire store.
  • Permissions by user and by role, globally or for each product.
  • 404 page or redirection to the page you choose for those without permission.
  • Purchase blocking: those who cannot see a product cannot add it to the cart (neither with a link nor via AJAX), nor request it again, nor purchase it in the cart and block checkout. If a product in the cart is no longer allowed, it is removed with a notice.
  • Hiding in all listings: store, categories, tags, search, shortcode
    , product blocks, widgets, related products, targeted sales, and cross-sells. Users with permission still see them.
  • Out of Google and APIs: private products do not appear in sitemaps, feeds, oEmbed, the REST API, or the Store API for those who cannot open them, and the 404 page does not leak its title or image.
  • In Spanish, accessible and compatible with block checkout, HPOS, and multisite.
  • For developers: functions and filters to know if a user can purchase a product, obtain hidden products, or change texts.

Security: a private product does not leak anywhere

Hiding a product from the store is not very useful if it still appears in search, in the sitemap, or in the API, or if it can be purchased with a link. In version 1.3, I thoroughly reviewed all those paths: purchase, REST API and Store API, feeds, sitemaps, oEmbed, blocks, shortcodes, widgets, reviews, media, and WooCommerce caches. All follow the same rule: if you cannot open the product, you do not see it or purchase it.

What is out of reach, and it is good to know, is another plugin or a theme that loads a product directly by its ID or that caches the same page for all visitors. If you use a full-page cache, exclude private product pages from it.

Requirements

  • WordPress 6.5 or higher (tested up to 7.1) and WooCommerce 8.7 or higher (tested up to 11.3).
  • PHP 8.2 to 8.5 guaranteed; it also works on PHP 7.4 and 8.1.

Price

Private Products for WooCommerce is sold with an annual license starting at €40, with updates and support while the license is active. The plugin's features work the same with or without an active license: the license is for receiving updates. You have all the details on the Private Products for WooCommerce page.

Frequently Asked Questions

How do I hide a product in WooCommerce so that only some customers see it?

With Private Products, open the product, go to the 'Private Product' tab, check 'Enable Private Product' and choose the users or roles that can see it. Other visitors receive a 404 page or the page you have chosen.

Can I show products only to registered users?

Yes. Guests never see a private product. To allow any registered customer to see it, enable the 'Customer' role; to limit it further, allow only the roles or users you want.

Can I hide an entire category of products?

Yes. In the global settings, you choose the private categories and tags, and all their products become private for those without permission.

Is it suitable for setting up a wholesale or B2B store in WooCommerce?

Yes. Create a role for your distributors, mark the products in the wholesale catalog as private, and allow only that role. The general public does not see them or can purchase them, and your distributors buy normally.

Can I make the entire store private?

Yes. Activate 'Make all your products private' and choose the users and roles that can see the store. For everyone else, the products do not exist.

Do private products appear on Google?

No. They do not appear in sitemaps or feeds, and their page responds 404 to those without permission, which is what the search engine sees. If a product was already indexed, Google will gradually remove it upon finding the 404.

Can someone without permission purchase a private product with the link?

No. Adding it to the cart with a link, via AJAX, or with 'Request Again' is rejected, and the cart and block checkout also block it.

Can I explain to the visitor why they do not see the product?

Yes. Create a page with your message (for example, 'This catalog is for registered wholesale customers') and select it in 'Redirection'. Those without permission will go to that page instead of the 404.

What happens to my data if I delete the plugin?

Deactivating it does not delete anything. When you remove it, the license data is deleted, and your settings and the privacy of each product are only deleted if you check 'Delete all plugin data when the plugin is deleted' beforehand.

¡No te pierdas las novedades!

¡No hacemos spam! y te puedes dar de baja cuando quieras

Share
JC
Jose Conti
Desarrollador WordPress y WooCommerce. Buceando en WordPress desde 2004.

Leave your comment

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