How to Restrict WooCommerce Add to Cart by User Role
WooCommerce’s default behaviour is completely open: every product is available to every visitor, logged in or not. That works for a standard retail store, but it breaks immediately for B2B stores, wholesale operations, membership sites, or any shop where pricing or product access needs to be controlled.
Common Scenarios That Require Role-Based Cart Control
- Wholesale pricing — prices are only valid for registered wholesale accounts, not the general public
- Members-only products — certain items are exclusive to paid members or subscribers
- B2B purchasing — products are not available for retail purchase, only to approved business accounts
- Tiered access — different product catalogues for different customer tiers
- Age-restricted products — require account verification before purchasing
What WooCommerce Provides Natively
Out of the box, WooCommerce has no user role restrictions on the add-to-cart flow. You can hide prices or add to cart buttons with custom CSS, but the product is still purchasable by anyone who finds the checkout URL. That’s not access control — it’s decoration. Proper restriction happens at the cart and purchase validation level.
Setting Up Role-Based Add to Cart Restrictions
Step 1 — Install Woo Advanced Add to Cart
Install and activate the Woo Advanced Add to Cart plugin. This adds a Restrictions panel to each product’s data tabs in the WooCommerce product editor.
Step 2 — Configure Per-Product Restrictions
Open the product you want to restrict. In the product data tabs, navigate to the Restrictions panel. You can configure:
- Login required — only logged-in users can add to cart
- Allowed roles — specify which user roles can purchase (e.g.,
wholesale_customer,subscriber) - Blocked roles — allow everyone except specific roles
- Custom message — what to display to restricted users instead of the add-to-cart button
Step 3 — Set a Redirect or Login Prompt
For guests who hit a login restriction, configure the plugin to show a “Login to purchase” button with a redirect back to the product page after authentication. This preserves the purchase intent rather than sending the visitor to a generic account page.
Step 4 — Global Defaults
For stores where most or all products have the same restriction (e.g., all products require a wholesale account), set the global default in the plugin settings rather than configuring each product individually. Per-product overrides still work on top of this default.
Testing Your Restrictions
Always test in a logged-out browser session and in a session with each role you’ve configured. Restrictions can behave differently depending on caching plugins — make sure your cache excludes cart and product pages for logged-in users, or test with cache disabled.
Combining Role Restrictions with Custom Pricing
Role-based cart restrictions work best alongside role-based pricing. If wholesale customers get 40% off, show them the wholesale price on the product page (using a dynamic pricing plugin) and restrict the add-to-cart to that role. Regular visitors see either a “Login for wholesale pricing” message or the standard retail price, depending on your setup.
Looking for WooCommerce plugins?
GrandPlugins — Lightweight WordPress & WooCommerce Plugins
Cart control, pricing rules, media watermarking & more. Affordable and actively supported.

