yireo / magento2-salesblock2
yireo/magento2-salesblock2
Block transactions based on various rules
Yireo SalesBlock2 for Magento 2
Prevent Magento 2 orders from being placed, based on specific rules.
Also see yireo.com/software/magento-extensions/salesblock2
Installation
To install this module, use composer:
composer require yireo/magento2-salesblock2
Afterwards, enable the module and run the setup upgrade, to make sure the database table is properly created:
bin/magento module:enable Yireo_SalesBlock2
bin/magento setup:upgrade
Next, install (and enable) one or more of the additional plugins. Without these plugins, the SalesBlock2 extension will not work:
- github.com/yireo/Yireo_SalesBlock2ByIp
- github.com/yireo/Yireo_SalesBlock2ByEmail
- github.com/yireo/Yireo_SalesBlock2ByGeo (also requires the PHP GeoIP module)
Usage
Navigate in the Magento Admin Panel to the Store Configuration to enable this module. Then, navigate in the Magento Admin Panel to Sales > Sales Block Rules to configure a rule. A rule consists of the following parts:
- Enable: Yes or no.
- Label: For managing things in your backend.
- Conditions: One or more conditions that all need to be met, before the rule is a match. The conditions are activated only through additional modules (see above). For instance, you could say that you are blocking sales for a person, coming from a certain IP range and using a specific email address.
- Frontend label: The message to display to the blocked customer on the frontend.
- Frontend text: An additional explanation to display to the blocked customer.
For additional details, see the READMEs of all submodules.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[Unreleased]
[2.2.7] - 22 October 2025
Fixed
- Change virtual type ending with Logger to prevent DI debug message
- PHP 8.4 compat
- Fix issue with rule not found by any matcher
[2.2.6] - 14 August 2025
Fixed
- Better fix
[2.2.5] - 14 August 2025
Fixed
- PHP 8.4 compat
[2.2.4] - 11 April 2024
Fixed
- Removed helper
[2.2.3] - 11 April 2024
Fixed
- Bug when no rules are matched by any matcher
[2.2.2] - 9 April 2024
Fixed
- Compat psr/log with Magento 2.4.7
- Rename Match/ folder to RuleMatch/ for PHP 8.2 compat
[2.2.1] - 8 April 2028
- Failed release
[2.2.0] - 16 April 2022
Fixed
- PHP 8 compatibility (and therefore Magento 2.4.4)
[2.1.5] - 16 March 2022
Fixed
- Converted InstallSchema into DB schema XML
Removed
- Remove deprecated unit tests
[2.1.4] - 10 March 2022
Removed
- Removed unneeded module version
- Remove button dep with CMS module
[2.1.3] - 9 March 2022
Fixed
- Fix broken namespace
bd20f5d4773b621e93f13932581e6b2fc85fb677
[2.1.2] - 2 March 2022
Fixed
- Remove dep with SalesBlock2ByEmail module
[2.1.1] - 2 March 2022
Fixed
- Remove PHP dep from composer
- Add required utility to core package
[2.1.0] - 18 February 2021
Fixed
- Code compliance with Magento PHPCS
- Fixed issue with Guest Checkout email not being properly picked up
Added
- Added additional event observer to guarantee blocking of guest orders
- Debugging with
var/log/yireo_salesblock.logfile
[2.0.4] - 24 November 2020
Fixed
- Issue when checkout is accessed directly
- Removed deprecated observer
- Set items_count to 0 as well to force "no-items" in cart
[2.0.3] - 29 July 2020
Added
- Magento 2.4 compatibility
[2.0.2] - 15 July 2019
Added
config.xmlwith default settings- Handy methods in rule repository
- Strict typing in rule repository and interface
- Integration test for rule repository
- Integration test for rule helper with simulation of IP and email matching
[2.0.1] - 4 July 2019
Added
- Add KeepAChangeLog support
- Move configuration to separate Yireo section
[2.0.0] - November 2018
Added
- Magento 2.3 compatibility
- Major rewrite to decouple rules from main module
[1.0.1] - August 2018
Added
- Create separate Configuration class instead of using Helper
- Add message in grid when module is disabled through setting
[1.0.0] - August 2018
Added
- Public release
- Composer support
[0.0.3] - June 2019
Added
- Beta testing on limited sites
- Improved exception handling
[0.0.2] - November 2017
Added
- Main migration of functionality
- Setup UiComponents
- Basic Integration Tests
[0.0.1] - September 2017
Added
- First draft
| Version | Stability | QA Status | Compatibility | Released |
|---|---|---|---|---|
| 2.2.7 | stable | Fail | Magento 2.4.7-2.4.8 Details | 2025-10-22 11:21:22 |
| 2.2.6 | stable | Not tested | Not yet tested Details | 2025-08-14 10:28:56 |
| 2.2.5 | stable | Not tested | Not yet tested Details | 2025-08-14 10:21:36 |
| 2.2.4 | stable | Not tested | Not yet tested Details | 2024-04-11 10:11:32 |
| 2.2.3 | stable | Not tested | Not yet tested Details | 2024-04-11 09:53:18 |
| 2.2.2 | stable | Not tested | Not yet tested Details | 2024-04-09 13:56:26 |
| 2.2.1 | stable | Not tested | Not yet tested Details | 2024-04-08 10:10:04 |
| 2.2.0 | stable | Not tested | Not yet tested Details | 2022-04-16 13:16:57 |
| 2.1.5 | stable | Not tested | Not yet tested Details | 2022-03-16 12:38:05 |
| 2.1.4 | stable | Not tested | Not yet tested Details | 2022-03-10 18:27:19 |
| 2.1.3 | stable | Not tested | Not yet tested Details | 2022-03-09 16:09:18 |
| 2.1.2 | stable | Not tested | Not yet tested Details | 2022-03-02 08:53:21 |
| 2.1.1 | stable | Not tested | Not yet tested Details | 2022-03-02 08:50:52 |
| 2.1.0 | stable | Not tested | Not yet tested Details | 2022-03-02 08:40:02 |
| 2.0.4 | stable | Not tested | Not yet tested Details | 2020-11-24 13:34:57 |
| 2.0.3 | stable | Not tested | Not yet tested Details | 2020-07-29 09:33:34 |
| 2.0.2 | stable | Not tested | Not yet tested Details | 2019-07-15 18:32:13 |
| 2.0.1 | stable | Not tested | Not yet tested Details | 2019-07-08 11:45:23 |
| 2.0.0 | stable | Not tested | Not yet tested Details | 2018-11-29 20:32:06 |
| 1.0.0 | stable | Not tested | Not yet tested Details | 2018-08-22 07:23:50 |
Requires 9
| Package | Constraint |
|---|---|
| magento/framework | ^101.0|^102.0|^103.0 |
| magento/module-backend | ^100.0|^101.0|^102.0 |
| magento/module-checkout | ^100.0 |
| magento/module-cms | ^100.0|^101.0|^102.0|^103.0|^104.0 |
| magento/module-store | ^100.1|^101.0 |
| magento/module-quote | ^100.1|^101.0|^102.0 |
| psr/log | ^1 || ^2 || ^3 |
| ext-json | * |
| ext-pcre | * |
Requires-dev 2
| Package | Constraint |
|---|---|
| phpunit/phpunit | * |
| composer/composer | *@dev |
Suggests 3
| Package | Reason |
|---|---|
| yireo/magento2-salesblock2-by-geo | * |
| yireo/magento2-salesblock2-by-ip | * |
| yireo/magento2-salesblock2-by-email | * |
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.
Static analysis
Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.
| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 106 | 106 warnings (ruleset: Magento2) — 89 auto-fixable with phpcbf |
| PHPMD | Warning | 17 | 17 rule violations (UnusedFormalParameter:6, UndefinedVariable:4, IfStatementAssignment:4, MissingImport:2, EmptyCatchBlock:1) |
| Cpd | Warning | 1 | 1 duplicated chunk spanning 27 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |
PHPStan
Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
Unit tests
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
More from yireo
View vendorTurn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.