I'm selling extensions (well, as of yet, only EmailTester2) and trainings (a lot). Once in a while, I find myself seeing an incoming sales order, for which I can't or don't want to provide support because of reasons: Spam, cancel-anything-behaviour, political incorrectness, whatever. In the past, I built the Yireo_SalesBlock2 for this. And in these times, I felt it would be good to mention its ability to block by geographical region.
From commercial to free
The Yireo SalesBlock2 module has a simple task: To prevent an incoming sales order from being placed. The reasons for this might be numerous: Perhaps you don't want the competition to buy from you, perhaps you simply hate a specific person, perhaps you were mailed in the middle of night by a drunk customer, demanding support while cursing a lot, perhaps you see some geopolitical reason to block an entire country.
Actually, all of the above happened to me in the past, even though I'm seeing myself as generally a nice person (though perhaps sometimes a bit too outspoken). In short, I had a good reason to write a module for this. A Magento 1 (what is that?) module was created ages ago. And a Magento 2 version was released as well. I sold these two modules for quite some time. But since Yireo has focused more and more upon live trainings and on-demand courses, last year (2021) I decided to turn most paid extensions into freebie. And this applied to SalesBlock2 as well. I don't know about the success ratio of this, because I never paid much attention to this and I never monitored how many people are using my open source extensions.
But here is a little promotion.
The SalesBlock2 architecture (see github.com/yireo/Yireo_SalesBlock2) is quite straight-forward. In the Magento Admin Panel, you can create rules based on certain conditions. For selecting conditions, add-on modules are required. Currently there are 3 of them:
- github.com/yireo/Yireo_SalesBlock2ByIp - Block based on IP patterns
- github.com/yireo/Yireo_SalesBlock2ByEmail - Block based on email patterns
- github.com/yireo/Yireo_SalesBlock2ByGeo - Block based on geographical locations (also requires the PHP GeoIP module)
Once the modules are installed and activated, the main SalesBlock2 extension uses them to extend upon the Magento Admin Panel, and to act upon their functionality in the frontend. Once a specific rule is created in the backend, the corresponding module is used on the frontend to see if a match is made. And if the match is there, sales is blocked. For sales to be blocked, a simple kill-cart strategy is used.
Blocking by geographical location
For instance, with the SalesBlock2ByGeo module, you can block by geographical location: Within a rule, you can enter a 2-letter or 3-letter definition of a country, or a 2-letter definition of an entire continent.
This can be used to block sales from any IP-address that is identified as coming from the Netherlands (
NLD). I think you can put it to good use for blocking countries based on (for instance) current geopolitical situations. Or block an entire continent, like Antartica.
Get started with my Magento 2 module by following the documented instructionsCheckout my Yireo SalesBlock2 module