Today’s Ask Jilt question comes from Dan:
I have a website where each school can sell their products, so I think I need a vendor plugin to do this. But, I don’t want customers from one school to snoop on products and the prices from another school. Can I make each school shopping page private so that customers only see the items for their school?
This is definitely possible! You’ll need the help of two plugins to achieve this set up:
Product Vendors is going to give you the ability to set up vendors and let them manage their own products, while Memberships will restrict who can view the products.
We wrote about using Product Vendors when we discussed creating a marketplace site with WooCommerce, so I’d recommend giving that a read if you’re not familiar with Product Vendors. We’ll be using it to create a vendor per each school, and then vendors can create their own products, or you can assign existing products to vendors.
Once vendors have been created, now we’ll get to the part about making the vendors’ catalogs private or restricted. There are a couple assumptions we need to make:
- to do this effectively, we need to require customers to log in to see products so we know what they should have access to (we don’t know this for a guest user, as we don’t know anything about them, such as an email address)
- we should probably hide vendor products from the catalog until a user is logged in, so they can’t see what products would be available from each school / vendor
The Memberships documentation has an outline of using Memberships with Product Vendors, but here’s the gist.
First, we’ll set up one membership plan per school or vendor. This plan is going to give customers access to that school / vendor’s products, but no one else’s. We’ll create a “Product Restriction” for the plan that grants access to the desired vendor.
Do this for each vendor, so this may require several plans.
Next, we want to hide these vendors’ products we’ve just restricted until a customer logs in so they only see products they should. Memberships has a setting that we’ll want to enable for this called “Hide Restricted Products”. If disabled, it would show a placeholder in the catalog like a “teaser” to encourage signups, but we want to just remove products completely, so we’ll enable it.
Now you need to determine how customers get access to a plan — do they have to apply to shop for a particular vendor? Or is public sign up allowed? If manual applications are required, you’ll need a form built with something Gravity Forms that you can use to collect registrations, and then you can manually create these member user accounts.
If you want to automate this and allow registration, I’d recommend using a free WooCommerce product, with variations for each vendor.
Then, make sure this product grants access to that vendor’s membership plan by editing the plan settings.
Now when a customer “purchases” this registration product, they’ll automatically get membership access, and thus be able to buy the products from their vendor / school.
Bonus tip: If you’re using a free product, you can simplify the WooCommerce checkout so it’s more like a registration form.
So what does this look like when it’s put together? If a guest customer, or a customer without vendor access, browses your site, they won’t see any products that are restricted / assigned to a vendor in the shop pages.
If the customer tries to access a vendor or product directly via URL, Memberships will show a “content restricted” message instead of the content.
When a customer who has access logs in, this experience will change. The shop / archive pages will now show products they can purchase, and they can access vendor listings directly as well:
This gives you a private vendor catalog for your WooCommerce store that only registered customers can access.
Hope this points you in the right direction, Dan!