viraxpress/restriction

ViraXpress Restriction Extension for Magento2

Maintainers

Package info

github.com/viraxpress/Restriction

Type:magento2-module

pkg:composer/viraxpress/restriction

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-04-17 11:18 UTC

This package is auto-updated.

Last update: 2026-06-10 10:25:41 UTC


README

A Magento 2 extension to create flexible access restrictions for products, category pages, CMS pages, and CMS blocks, with customer group and store-scoped rules.

Description

ViraXpress_Restriction lets admins define restriction rules that control frontend user access and behavior based on:

  • Customer group
  • Store view(s)
  • Date range (start_at, end_at)
  • Restriction target types: products, categories, CMS pages, CMS blocks
  • Response action: show an error message or redirect URL

Active restrictions apply in real-time via frontend event observers.

Features

  • Admin UI under Stores > Manage Restriction > Restriction Rule
  • Enable/disable module globally via system configuration (VX Restriction > General > Enable Manage Restriction)
  • Create/ edit/ delete rule records in grid UI
  • Restrict by:
    • specific products
    • product categories (and filter product collections globally)
    • CMS pages
    • CMS blocks
  • Add-to-cart blocking for restricted product rules

Compatibility

  • Magento 2.4.x

Installation

  1. Install the extension via Composer:

    composer require viraxpress/restriction
  2. Run the following commands from your Magento root directory:

    php bin/magento module:enable ViraXpress_Restriction
    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
    php bin/magento setup:static-content:deploy
    php bin/magento cache:flush

Usage

Configuration

Navigate to Stores > Configuration > VX Restriction > General and set Enable Manage Restriction to Yes.

Managing Restriction Rules

Go to Stores > Manage Restriction > Restriction Rule and click Add New Restriction Rule.

  • Set a title, date range, store view, and customer group for the rule.
  • Choose a response type — Error Message (with custom text) or Redirect (with a target URL).
  • Enable Restrict Products and select specific products.
  • Enable Restrict Categories to block access to category pages and filter their product collections.
  • Enable Restrict CMS Pages or Restrict CMS Blocks to hide specific pages or blocks.

How It Works

  • On each frontend request, observers check if the current customer's group matches an active rule within its date range and store view scope.
  • Exact product matches take priority over all wildcard matches.
  • On a match, the user is either shown an error message or redirected to the configured URL.
  • Disabling the module globally bypasses all observer checks without requiring rule deletion.