//you can use magento exception class to throw message after namespace
public function __construct(
$this->customerSession = $customerSession;
public function ...
It has taken some time, but I believe we have found the issue. For the sake of someone else out there who may have this situation, I will add the information.
It appears that the issue was with an Amasty extension, specifically Amasty_Shippingrestriction. When we upgraded the development site, we lost all of our Shipping Restrictions. Well, we retained ...
According to your question you need to hide free shipping method if 2nd value of postcode is 0, you can achieve it using below.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
The Shipping tab defines international and packaging data for products in your catalog. Data defined on this tab is used by Magento Shipping to pre-fill shipping information for customers during checkout and for other order fulfillment workflows.
Refer this link for more details :
I would recommend checking out the documentation for promotions/cart price rules - https://docs.magento.com/m2/ce/user_guide/marketing/price-rules-cart.html. The rules are flexible in that you can create promotions for only specific categories or down to the product level. I found that there is a bit of trial and error to learning what can be done.
You need to allow Backorders
Stores -> Configuration -> Catalog -> Inventory
Under Product Stock Options
Backorders -> Allow Qty Below 0
The Product will now need to be set to "In stock" for it to show add to cart buttons