Repository navigation
Releases: ROLLPIX/M2-DisableSales
Releases · ROLLPIX/M2-DisableSales
Release list
v1.1.7
Changes
- Fix: banner disappearing immediately after showing
- Removed
hideBanner()from the evaluation logic — intermediatecustomerDatastates (empty{}during section refresh) were triggering it and hiding the banner - Banner now only shows when conditions are met, never actively hidden (starts hidden via CSS in JS mode)
- Added NaN guard for
group_idwhen cached section data doesn't include it yet
- Removed
v1.1.6
Changes
- Updated README.md and README.es.md with documentation for:
- Customer group filtering (multiselect)
- "Show Only After Login" option for banner and modal
- Updated file structure, plugins table, and ViewModel methods
- New testing guide sections for group filtering and login transitions
v1.1.5
Changes
- Fix: reliable state updates after login/logout without needing Ctrl+F5
- Use
customerData.getInitCustomerData()to re-evaluate after Magento finishes refreshing section data - Handle browser back-forward cache (bfcache) via
pageshowevent - Reset banner dismissed state when login state changes (so logged-in restricted users see the banner)
- Properly hide banner when switching to a non-restricted group
- Use
v1.1.4
Changes
- Remove guest special case: "Not Logged In" (group 0) is now treated as a regular restricted group
- When group 0 is restricted: add-to-cart buttons are hidden via JS (same as logged-in restricted users)
- Banner/modal visibility respects
show_on_loginsetting: if unchecked, shows for all restricted users including guests - Removed AJAX add-to-cart intercept (no longer needed since buttons are hidden)
v1.1.3
v1.1.2
Bugfix
- Guest add-to-cart feedback: When a guest (Not Logged In group restricted) tries to add a product to cart, the server blocks it but previously showed no feedback. Now:
- The error message appears properly formatted in the standard Magento messages container
- The top banner is shown after the failed attempt so the customer understands sales are disabled
v1.1.1
Bugfixes
- Fixed JS ReferenceError:
addHideTocartStyleandremoveHideTocartStylefunctions were called but never defined, breaking the entire group filter JS component (add-to-cart hiding and banner visibility for logged-in restricted users) - Fixed missing
group_idin customerData: Magento's default customer section data does not includegroup_id. AddedCustomerPluginto inject it, enabling frontend JS to detect the customer's group
v1.1.0
Changes
- Customer group filtering: Sales disable can now target specific customer groups via multiselect in admin config. Leave empty for backward-compatible "all groups" behavior.
- Show Only After Login: New checkbox for banner and modal — only displays to logged-in customers whose group is restricted. Prevents confusing guests who may belong to unrestricted groups.
- Guest special case: When "Not Logged In" group is restricted, add-to-cart button stays visible but server blocks the action with an error message (since we can't identify the customer before login).
- All 4 server-side plugins (Cart Add, Quote AddProduct, API CartItemRepository, Checkout) now check customer group.
- New JS component (
disable-sales-group-filter.js) handles client-side visibility via Magento customerData for FPC compatibility. - New
CustomerGroupsource model for admin multiselect. - Added
Magento_Customermodule dependency. - Spanish translations for new config fields.
v1.0.0 - Initial Release
Rollpix_DisableSales v1.0.0
Magento 2 module to temporarily disable sales without affecting catalog navigation.
Features
- Block add-to-cart: controller plugin + quote model plugin + REST API plugin
- Block checkout (optional): redirect to cart with error message
- Top banner: dismissible, customizable colors and CSS, persists via localStorage
- Modal popup: centered, once per session, independent colors and CSS
- Banner + Modal can coexist simultaneously
- HTML support in message (plain text in error messages)
- Custom CSS fields pre-loaded with editable defaults
- es_AR translation included
- Zero performance impact when disabled
- 100% reversible: no database changes, no crons, no observers
Compatibility
- PHP 7.4 ~ 8.3
- Magento 2.4.x (Open Source / Commerce)
Installation
composer require rollpix/module-disable-sales
bin/magento module:enable Rollpix_DisableSales
bin/magento setup:upgrade
bin/magento cache:flushSPONSOR: www.rollpix.com