Showing results for 
Search instead for 
Did you mean: 

Link Customer and Product Attribute to Add-To-Cart or Checkout Process


Link Customer and Product Attribute to Add-To-Cart or Checkout Process

Some of our products require that our customers have specific information on file with us that permits them to order a class or type of product. If we don't have the certificate on file, they can't order that whole class or type of product. 


The products have the attribute set up in Catalog page that identifies them as being of that class/type, and the Customer page has an attribute specifying whether they've been approved for this class/type of products.


Think of this, as an example, that these are wood-working tools and without a wood-working certificate on file with us, they aren't allowed to order any of our hundreds of wood-working tools because it isn't safe or legal to do so and we aren't legally allowed to ship them to a customer.


All the wood-working tools have an attribute that's set that identifies them as wood-working tools.


The Customer profile has an attribute that is a yes-no that the customer can't access -only admins - that identifies whether they're approved by us to order wood-working tools.


We would like to easily link profile attributes (Product and Customer) to ensure that:

  • Only customers with the correct Customer profile set can order them, or
  • Customers without the correct profile are told they can't
    • Best solution, when they try to add to cart, the system has a pop-up to explain why they can't and they don't get added to cart
    • Worst case - they're warned and prevented from ordering these items but have the option to order any other items which may be in cart

We're on Magento 2.3.5p1.

Is there either (a) built-in behavior in Magento that I can invoke, or (b) a no-cost extension, or (c) code example available, or (d) a chargeable extension available?


We're a still-new, very cost sensitive site, trying to get off the ground.




Re: Link Customer and Product Attribute to Add-To-Cart or Checkout Process

The most common way that I've seen this done is to create Customer Groups using Magento's native Customer Group feature set. 


In this case, you might have a few. Just for example, not knowing the specifics of your business:


1) General

2) Carpenters

3) Plumbers

4) Roofers

5) General Contractors


You could then use an extension like:


This would allow you to set permissions, so that, for instance, specific categories of products would only be visible to specific user groups. So, using my example Customer Groups, the wood-working tools category of products could be restricted to only be visible and accessible to Carpenters, and General Contractors.There are other options, of course. For example, this extension would also allow you to flag products on an case-by-case basis, not just by category.


Best of luck!


Re: Link Customer and Product Attribute to Add-To-Cart or Checkout Process

Hi Robert,


Thanks for the reply. Unfortunately, we need to display all products, all the time to interest our customers, and there are thousands of products that fall into the potentially restricted category. We wouldn't want to shield their view to potential customers before we know if they're of the type who could purchase them from us.....


But this is one avenue we may have to explore, so I'll keep the Customer Groups idea in mind for the future. It sounds more like I'm going to need to learn how to write an extension for this, among the many other things I'm trying to manage.....


Re: Link Customer and Product Attribute to Add-To-Cart or Checkout Process

The extension that I mentioned doesn't require you to completely block the product pages.You could use the extension to manage which users can see the price of the items in question, or perhaps more importantly, which customer groups can add the items to the cart.


That way, all users could see the entire catalog - as could search engines like Google - but you could hide the parts (like Add-to-Cart buttons) from restricted products, and only allow users in approved customer groups to make the purchase.


Is that along the lines of what you're hoping to achieve? If not, feel free to share more details about your desired outcome, and I (or someone else) may have a different suggestion.


Best of luck!