Scanner says core files were modified? Open the diff. After wp2shell, that is often leftover access.

How to read it

WooCommerce Protected Categories: password and role gates

Set up WooCommerce Protected Categories (Barn2) with passwords, roles, or users. Test add to cart, cache pitfalls, and store hardening that still matters.

Topics WooCommerce & ecommerce Login & access

Updated Published

WooCommerce Protected Categories: password and role gates Open larger image: WooCommerce Protected Categories: password and role gates

Not every product should be public. Wholesale pricing, VIP drops, employee stores, and age-sensitive catalogs need access control. WooCommerce does not ship rich category locks by default, so many stores use a dedicated WooCommerce Protected Categories plugin.

This post covers WooCommerce Protected Categories by Barn2: what it is good for, how setup usually works, how to validate add to cart when locked, and the security limits of “password on a category.”

For whole-site or blog-category gates (not store catalogs), see password protect a WordPress site, page, or category.

Protect categories with WooCommerce Password Protected Categories

What the plugin is for

Barn2’s WooCommerce Protected Categories lets you restrict product categories so only the right people see (and buy) those items. Typical uses:

  • Wholesale or B2B catalogs
  • Member or subscriber collections
  • Private client selections
  • Soft-gated launches and staff-only SKUs

Access control for merchandising is not the same as full site security. It helps segmentation and pricing hygiene. It does not replace HTTPS, MFA, updates, or malware monitoring.

Key features (practical view)

Password protection

Assign one or more passwords to a category. Visitors enter the password before they see products. Simple for temporary campaigns. Shared passwords leak; rotate them when a campaign ends.

User role and individual user rules

Restrict by WordPress user roles (for example a wholesale role) or by specific accounts. Better for ongoing B2B than a single shared password. Apply least privilege so wholesale customers are not Administrators.

Inheritance

Protect a parent category and subcategories/products generally follow. Mixed public/private assignments can create surprises if a product also sits in a public category. Test as a logged-out user and as each role you care about.

Options to keep protected categories out of menus, widgets, and search reduce casual discovery. Determined people may still guess URLs; treat hiding as UX, not cryptography.

Step-by-step setup

Exact UI labels can change with plugin versions. The usual path:

  1. Purchase/download from Barn2, then Plugins → Add New → Upload and activate.
  2. Open WooCommerce → Settings → Protected Categories (or the plugin’s settings screen) and choose password, role, and/or user modes.
  3. Edit a category under Products → Categories, set visibility/protection, save.
  4. Test in a private window: guest, wrong password, correct password, and each relevant role.
  5. Share access only through channels you control (account invites, role assignment, private password delivery).

If anything fails after a cache plugin update, bypass or exclude protected archives from full-page cache and retest.

Add to cart and checkout validation

Gating the category archive is not enough if a product URL or cart endpoint still accepts purchases.

Test matrix:

| Actor | Category page | Product page | Add to cart | Checkout | | --- | --- | --- | --- | | Guest (locked) | Password / deny | Deny or password | Must fail | Must fail | | Wrong password | Deny | Deny | Must fail | Must fail | | Correct password / role | Visible | Visible | Allowed | Allowed |

Also check:

  • Direct product permalinks while locked
  • Search results and sitemaps for protected SKUs
  • REST or related-products widgets that might expose titles or prices
  • Coupons that should not apply to locked catalogs

If add to cart still works while the category looks locked, treat that as a failed setup until fixed on staging.

Protecting categories without shooting yourself in the foot

  • Prefer roles for long-lived wholesale access; use passwords for short campaigns
  • Avoid putting the same SKU in both a locked and a fully public category unless you intend that
  • Keep admin accounts on least privilege so staff cannot casually unlock catalogs
  • Document who owns password rotation when people leave the company
  • Remove the protection plugin’s leftover settings after you uninstall

Customize the unlock experience lightly

A clear password form, sensible redirect into the category, and a human message for denied access reduce support tickets. Match brand colors if you want. Do not bury the unlock flow under dark patterns.

Security that still matters around protected catalogs

Category locks sit on top of a normal WooCommerce site. Harden the store too:

Password-protected categories reduce accidental exposure. They are not a substitute for server hardening or a WAF when bots and scanners hit the shop. Cloud Firewall helps with known-bad traffic; category plugins do not.

Testing and maintenance

  • Retest protection after theme, cache, and WooCommerce updates (staging first)
  • Rotate shared passwords on a schedule if you must use them
  • Watch for plugin conflicts that expose restricted loops in sitemaps or feeds
  • Remove access when a wholesale account ends
  • Re-run vulnerability checks after major WooCommerce upgrades

Bottom line

WooCommerce Protected Categories is a practical way to gate wholesale, VIP, or private catalogs without building a second store. Use role-based access for lasting segments, treat shared passwords as temporary, validate add to cart while locked, and keep normal ecommerce security in place. Exclusivity helps merchandising. Patching, MFA, and honest payment architecture protect the business.

Found this useful? Share it.

Frequently asked questions

What is WooCommerce Protected Categories? +

A Barn2 plugin that restricts product categories so only people with the right password, role, or user account can see and buy those products. Common for wholesale, VIP, and private catalogs.

Can I password protect WooCommerce products by category? +

Yes. Assign password, role, or user rules on the category, test as a guest and as each role, and confirm add to cart fails when locked. Prefer roles for long-lived B2B access.

Does category protection replace WordPress security? +

No. It is merchandising access control. You still need HTTPS, admin 2FA, updates, backups, and a firewall against bots.

Larger screenshot

Enlarged image