1. Product Specification 

Catalog Restriction based on Customer Group is a Magento 2 extension developed by PIT Solutions which helps admin users to show or hide products for certain customer groups in frontend.

It allows the admin user to assign permission to products for each customer group. By setting catalog permission for customer groups, store owners can hide the products they do not want to share with specific customer groups.

The extension offers different behaviour options when a customer from a restricted group tries to access a restricted product. Admin users can configure the behaviour to redirect the customer to a specific page or URL, such as Login page, or Not Found page based on restriction behaviour.

2.Installation Steps

 To install the Catalog Restriction Based on Customer Group extension, follow the steps below. 

1) Download the extension. 

2) Access your web server directories and unzip and upload the content of the zip file to app/code/Pits/ProductRestriction directory. 

3) Run the below commands on terminal 

  • Enable the module - php bin/magento module:enable Pits_ProductRestriction 
  • Update the database schema - php bin/magento setup:upgrade 
  •  Generate and pre-compile classes - php bin/magento setup:di:compile 
  • Deploy static files - php bin/magento setup:static-content:deploy 
  • Clear the cache – php bin/magento cache:flush 

 3. Features

  • Can easily Enable/Disable the Catalog Restriction Based on customer group extension.
  • Admin can configure it based on the requirements.
  • Can hide the restricted product for specific customer groups.
  • Can manage the Restriction Behaviour when restricted customer tries to access the restricted product.
  • Admin has allow and deny options for customer group restriction.

 4. Screenshots / Video

 4.1. Admin Panel Configuration

Navigate to Admin -> Stores -> Configuration -> Pits Configuration -> Product Restriction by Customer Group.

Catalog Restriction by Customer Group Configuration

  • Enabled: To enable the extension select Yes.
  • Restriction Behaviour
    • Redirect to Login Page - When customer tries to access a restricted product he will be redirected to login page or My Account page.
    • Not Found Page - When customer tries to access a restricted product he will be shown a Not found page.

Customer Group Restriction (Catalog - > Product) 

To restrict the catalog for a specific customer group,

  • Go to Catalog -> Product -> Select a product-> Select the section Customer Group Restrictions.
  • Restriction Groups: Select the customer groups for which the particular product should be restricted.
  • Restriction Group Behaviour: This sets how the restriction should behave when a customer tries to access the product. If the behaviour is set as Deny, then the customers with selected customer group will not have access to the product, and if the behaviour is set as Allow then only the customers with the selected customer group will have access to the product.

4.2.How It Works On Frontend 

In frontend, the products are displayed based on the customer group and its behaviour. If in Admin configuration the restriction behaviour is set as Not Found Page then the customer will be shown a 404 (Product Not Found) page when tries to access a restricted product. And if in Admin configuration the restriction behaviour is set as Redirect to Login Page then the customer will be redirected to the login page if the customer is not logged in and to the My Account page if the customer is already logged in.

SIMPLE PRODUCT

In Catalog -> Product, Customer Group Restriction: Set Restriction Groups as NOT LOGGED IN and Restriction Groups Behaviour as Deny.

In this scenario, the Joust Duffle Bag is allowed for all the customer group except NOT LOGGED IN. The restricted products will not be visible anywhere in the frontend and if customers try to access the product or its detail page directly, then they will be redirected to the 404 Page or to the login page as per the configuredrestriction behaviour.

Customer Group – NOT LOGGED IN

The restricted product will remain invisible to the restricted customer group. Even if a product is already on their Wishlist or comparison list before it becomes restricted, these restricted customers will not be able to purchase that particular product after the restriction is applied. Additionally, if the restricted product name appears in the sidebar, it will redirect users according to the specified restriction behaviour.

Customer Group – General

When customer group is LOGGED IN and the product is allowed for that specific customer group, the product becomes visible, and the customer can access and purchase it as needed.

CONFIGURABLE PRODUCT

In Catalog -> Product, Customer Group Restriction: Set Restriction Groups as NOT LOGGED IN and Restriction Groups Behaviour as Deny.

In this scenario, the product "Breathe-Easy Tank-S-White" is accessible to all customer groups except for the "NOT LOGGED IN" group. This restriction applies specifically to the child product "Breathe-Easy Tank-S-White" in a configurable product.

When customers are selecting swatches (likely for product variants or options), the swatch associated with the restricted product is visually marked or "stricken off." This indicates that the restricted product is not available to the customer. Therefore, customers belonging to the restricted group won't be able to access or purchase the particular child product, "Breathe-Easy Tank-S-White."

If the restricted product is the parent product of a configurable product, the entire configurable product, including all its child product variations, will not be visible to the restricted customer group and if customers try to access the product or its detail page directly, then they will be redirected to the 404 Page or to the login page as per the configured restriction behaviour

Customer Group – NOT LOGGED IN

The product “Breathe-Easy Tank-S-White” is restricted for NOT LOGGED IN customer. When the customer tries to access the restricted child product, the associated swatch is visibly marked as "stricken off," and as a result, the customer is unable to access or purchase it.

Customer Group – General 

When customer group is LOGGED IN and the product is allowed for that customer group, the product becomes visible, and the customer can access and purchase it as needed.

GROUPED PRODUCT

In Catalog -> Product, Customer Group Restriction: Set Restriction Groups as NOT LOGGED IN and Restriction Groups Behaviour as Deny.

In this scenario, the product "Sprite Yoga Strap 6 foot" is available for all customer groups, except for the "NOT LOGGED IN" group. However, when the product that is restricted from a grouped product is restricted, it will not be displayed for the restricted customer group and if customers try to access the product or its detail page directly, then they will be redirected to the 404 Page or to the login page as per the configured restriction behaviour.

Customer Group – NOT LOGGED IN

If the product "Sprite Yoga Strap 6 foot" is restricted for "NOT LOGGED IN" customers and its part of a grouped product that includes three simple products, when one of these simple products is restricted for the customer group, the restricted simple product will not appear on the product detail page. In this case, the restricted product is effectively hidden from customers in the "NOT LOGGED IN" group, and they won't be able to view or access that particular product when viewing the details of the grouped product.

Customer Group – General

When customer group is LOGGED IN and the product is allowed for that customer group, the product becomes visible, and the customer can access and purchase it as needed.

BUNDLE PRODUCT

In Catalog -> Product, Customer Group Restriction: Set Restriction Groups as NOT LOGGED IN and Restriction Groups Behaviour as Deny.

In this scenario, "Sprite Foam Yoga Brick" is the product in bundle product, is available for all customer groups, except for the "NOT LOGGED IN" group. The bundle product detail page will be redirect according to restriction behaviour. However, when the bundle product is restricted, it will not be displayed for the restricted customer group and if customers try to access the product or its detail page directly, then they will be redirected to the 404 Page or to the login page as per the configured restriction behaviour

And the simple product “Sprite Yoga Strap 6 foot” and “Sprite Yoga strap 8 foot” restricted for both NOT LOGGED IN and general customer.

Customer Group – NOT LOGGED IN

The product "Sprite Foam Yoga Brick" is restricted for NOT LOGGED IN customer group in bundle product. If any of the product is restricted in the bundle product, the product will be out of stock in listing page and the restricted customer won’t be able to view the detail page of bundle product in this scenario.

Customer Group – General

When a customer belongs to the "LOGGED IN" group, and the product is allowed for that specific customer group, the product becomes visible. In this scenario, both "Sprite Yoga Strap 6 foot" and "Sprite Yoga Strap 8 foot" from the "Sprite Yoga Strap" product are restricted for the general customer group. As a result, general customers won't be able to access or purchase these particular restricted products. However, they can still purchase the remaining products based on their needs.

5.Important Notes:

  •  Restricting products from the customer will not work as intended if the products are already in the cart or in the Wishlist. Cart totals may get affected if the products which are already in cart are restricted. 
  •  Products may still be available in the Wishlist after restricting them from the admin. 

6. Technical Requirements / Compatible with:

Magento Community 2.3.x, 2.4.x

7. Supported Languages

English, German, French 

8. Change Log / Release Notes

 Version: 1.0.2: May 2024 

  • Magento 2.4.7 compatibility fixes and improvements. 

Version: 1.0.1: November 2023 

  • Magento 2.4.6-p3 compatibility changes and improvements. 

Version: 1.0.0: July 2023 

  • Initial version 

9. Support

If you have questions, use our contact form at webshopextension.com or email at support@webshopextension.com