1. Product Specification

Category Restriction based on Customer Group is a Magento 2 extension developed by PIT Solutions which helps admin users to restrict categories for certain customer groups in frontend.

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

The extension has “Use Parent Category” option, and by configuring this we can easily restrict the child category.

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

2. Features 

  • Can easily Enable/Disable the Category Restriction Based on customer group extension.
  • Admin can configure it based on their requirements.
  • Can hide the restricted categories for the specified customer groups.
  • Can configure how the restriction should behave when customer tries to access the restricted category, like show 404 page (Page not Found) or redirect to the login page.
  • Admin has "allow" and "deny" options for customer group restriction.
  • Can easily restrict the child category using “Use Parent Category Settings” configuration

3. Installation Steps

To install the Category Restriction by Customer Group Extension for Magento 2,follow the steps below. 

  • Download the extension.
  • Access your web server directories and unzip and upload the content of the zip file to app/code/Pits/ CategoryRestriction directory.
  • Run the following commands from the SSH terminal of the server to complete the installation.
    • Enable the module - php bin/magento module:enable Pits_CategoryRestriction
    • 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

4. Screenshots / Video

4.1 Admin Panel Configuration

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

Category Restriction by Customer Group Configuration

Figure 1

Category Restriction by Customer Group Configuration

  • Enabled: To enable the extension select “Yes”.
  • Restriction Behaviour
    • Redirect to Login Page - if a customer is restricted, he will be redirected to login page.
    • Not Found Page - if a customer is restricted, he will be shown a 404 (Page not Found) error.
  • Use Parent Category Settings: This option is for Categories. If you want to apply the group restriction of parent category to all of its child categories select “Yes”. If a category is configured to have a specific restriction behaviour, then that configuration will have priority over its parent category configurations.
  • Hide Restricted Categories: To hide the restricted categories from the frontend, select “Yes”. 

Customer Group Restriction 

To restrict the category for a specific customer group,

  • Go to Catalog -> Categories -> Select a necessary category -> Select the section “Customer Group Restrictions”.
  • Restriction Groups: Select the Customer groups for which the categories need to be restricted.
  • Restriction Group Behaviour: 

Figure 2

This sets how the restriction should behave when a customer tries to access the category. If the behaviour is set as Deny, then the customers with selected customer group will not have access to the category, and if the behaviour is set as Allow then only the customers with the selected customer group will have access to the category. 

4.2 Frontend display

In frontend, the categories are displayed based on the customer group restriction. If Hide Restricted Categories configuration is set as YES, then the categories will not display in the frontend for the particular customer group.

Configure the general settings as Figure 2 and change the category restriction configuration as required. 

Figure 3

In Admin Panel -> Catalog -> Category, Customer Group Restriction: Set Restriction Groups as NOT LOGGED IN and Restriction Group Behaviour as “Allow”.

In this scenario, the category will be allowed only when the customer is not logged in and for all customers with other groups it will be redirected to login page or 404 (Page not Found) as configured in admin configuration (Restriction Behaviour in Figure 3). 

Customer Group – NOT LOGGED IN

As an example, we have configured restriction on the category Women in the image. The access is enabled only for the not logged in customers or the customers with customer group Not Logged In

Figure 4

Customer Group – General

As mentioned above category Women is restricted for all other customer groups except Not Logged In and for that customer group the restriction behaviour is configured as Not found page. So, when a customer with any other customer group tries to access the category it will redirect to 404 (Page not Found) based on the configured restriction behaviour.

Figure 5

Configuring Hide Restricted Categories as YES

Figure 6

As an example, if we set Use Parent Category Settings as No and Hide Restricted Categories as YES, then the restriction category will be hidden and its child categories will come under the parent category. 

Figure 7

f the Tops category is restricted and its child categories are not restricted, then Tops will be hidden and all its child categories will come under the parent category. 

Figure 8

5. Technical Requirements / Compatible with: 

Magento Community 2.3.x, 2.4.x

6. Supported Languages

English, German, French

7. Change Log / Release Notes

Version: 1.0.2: March, 2024

  • Magento 2.4.6-p4 compatibility changes and improvements.

Version: 1.0.1: December, 2023

  • Magento 2.4.6-p3 compatibility changes and improvements.

Version: 1.0.0: September, 2023

  • Initial version

8. Support

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