Yireo_SalesBlock2

PHP 8.1 - 8.4
Magento 2.4.7 | 2.4.8
CSP Yes
Unit Tests 5
Integration Tests 16
PHPStan 1
Magento PHPCS 8
Latest Release 2.2.9

Magento version PHP version License Latest Version

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:

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.

Current status

Static Tests Unit Tests Integration Tests Playwright DI Compilation

Support

For getting support, create an Issue under the following project URL:

https://github.com/yireo/Yireo_SalesBlock2

Configuration Options

The following options of this module can be configured via the Store Configuration:

Settings > Enabled
salesblock/settings/enabled
Settings > Logging
salesblock/settings/logging
Settings > Destroy cart
salesblock/settings/destroy_cart
Module Dependencies

The following dependencies are declared in the module its `etc/module.xml` file:

Magento_AdminNotification Magento_Backend Magento_Catalog Magento_CatalogInventory Magento_Checkout Magento_Cms Magento_Config Magento_Csp Magento_Customer Magento_Directory Magento_Eav Magento_Indexer Magento_Payment Magento_Quote Magento_Rule Magento_Sales Magento_SalesSequence Magento_Store Magento_Theme Magento_Ui Magento_Variable
Composer details
Magento module name
Yireo_SalesBlock2
Composer name
yireo/magento2-salesblock2
Composer version
2.2.9
Default branch
master
Requirements
ext-json: *
ext-pcre: *
magento/framework: ^101.0|^102.0|^103.0
magento/module-backend: ^100.0|^101.0|^102.0
magento/module-catalog: ^104.0
magento/module-checkout: ^100.0
magento/module-cms: ^100.0|^101.0|^102.0|^103.0|^104.0
magento/module-config: ^101.2
magento/module-customer: ^103.0
magento/module-quote: ^100.1|^101.0|^102.0
magento/module-sales: ^103.0
magento/module-store: ^100.1|^101.0
magento/module-ui: ^101.2
php: >=8.2 <8.6
psr/log: ^1 || ^2 || ^3
symfony/console: ^5.0 | ^6.0 | ^7.0
Releases
2.2.9 23 October 2026
2.2.8 23 October 2026
2.2.7 23 October 2026
2.2.6 23 October 2026
2.2.5 23 October 2026
2.2.4 23 October 2026
2.2.3 23 October 2026
2.2.2 23 October 2026
2.2.1 23 October 2026
2.2.0 23 October 2026
2.1.5 23 October 2026
2.1.4 23 October 2026
2.1.3 23 October 2026
2.1.2 23 October 2026
2.1.1 23 October 2026
2.1.0 23 October 2026
Changelog

[2.2.9] - 19 October 2026

Fixed

  • Loosen up constraint for symfony/console

[2.2.8] - 19 October 2026

Fixed

  • Stop returning a value from command constructors
  • Add int return type to CLI command execute() methods for Symfony Console compatibility

[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.log file

[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.xml with 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

Last modified: October 17, 2026