The Shipping Restrictions Extension for Magento 2 allows store administrators to control which shipping methods are available during checkout.
Shipping restrictions can be created based on the customer's shipping address, products in the cart, customer group, store, coupon, or a specific day and time.
For example, you can restrict a particular shipping method for a specific state, prevent certain products from being shipped using a selected carrier, or apply different shipping rules for different customer groups.
The extension works with Magento's standard shipping rate collection and also supports React Checkout Pro.
{all-products} and {last-product} in the restriction message.Please refer to the installation guide in the following article:
After the extension is installed, go to the Magento Admin and open:
Towering Media → Checkout & Payments → Shipping Restrictions
You will see the Shipping Restrictions grid with the rules already created.
Click Add New Rule to create a new shipping restriction.
The grid shows the shipping restriction rules configured in the store.
From the grid, you can:
Click Select to see the available actions for an existing rule.
When you add a new rule, the configuration is divided into the following sections:
This section is used to decide which shipping methods should be restricted when the rule matches.
Enter a name for the rule.
Use a name that makes it easy to understand the purpose of the rule later.
For example:
Block Table Rate for New York
Set the rule to Active when you want Magento to use the rule.
If the rule is not required temporarily, you can set it to Inactive.
Enter the shipping methods that should be restricted.
Enter one method per line.
For example:
Table Rate
Use this option when you want to restrict all shipping methods provided by a particular carrier.
The carrier list comes from the shipping methods configured in Magento.
Select the required carrier from the list.
Enter the message that should be shown when the restriction is applied.
For example:
We do not ship to New York using this shipping method.
Keep the message clear so the customer understands why the shipping option is not available.
The Conditions section decides when the shipping restriction should be applied.
The available conditions can be used to check information such as the shipping address, cart and products.
For example, if shipping should be restricted for customers in New York, configure the condition as:
Shipping State/Province is New York
The rule will be checked when the customer's shipping address matches the configured condition.
You can also combine conditions when the restriction needs to apply only to a particular situation.
For example:
Shipping State/Province is New York AND Customer Group is General
This will limit the restriction to customers in the selected group.
The Coupons section can be used when the shipping restriction depends on a coupon or shopping cart rule.
Use this option when the restriction should only apply when a particular coupon or shopping cart rule is used.
You can specify:
Use this option when the restriction should not be applied when a particular coupon or shopping cart rule is used.
You can specify:
This section controls where the rule is applied and which customers are affected.
Set this option to Yes if the restriction should also be applied in the Magento Admin area.
Select the stores or store views where the rule should apply.
Leave the field empty if the rule should apply to any store.
Select the customer groups that should be affected by the rule.
The list may include groups such as:
Leave the field empty if the rule should apply to any customer group.
Use this section when the restriction should only be active on certain days or during specific hours.
Select the days when the rule should apply.
Available options are:
Leave the selection empty if the rule should apply every day.
Select the time when the restriction should start.
Select the time when the restriction should end.
Make sure the Magento store time zone is correct when using time-based restrictions.
After completing the rule configuration, click Save Rule.
The rule will then appear in the Shipping Restrictions grid.
It is recommended to test the rule from the storefront before using it on a live store.
Here is a simple example of restricting a shipping method for customers shipping to New York.
We do not ship to New York using this shipping method.
Customers do not need to do anything extra when the extension is enabled.
The extension checks the configured rules when Magento calculates the available shipping methods during checkout.
If the customer's checkout information matches an active restriction rule, the selected shipping method will be restricted.
For example:
If the customer changes the shipping address or other information so that the rule no longer matches, the shipping method can become available again.
If a shipping restriction is not working as expected, check the rule configuration first.
Check the following:
You can clear the Magento cache with:
bin/magento cache:flush
Check the active shipping restriction rules.
Another rule may be restricting the same shipping method.
Also check:
If several rules apply to the same shipping method, review them together to find which rule is causing the restriction.
Open the Conditions section and check the Shipping State/Province condition.
Make sure the value selected in the rule matches the value used in the customer's shipping address.
Try another checkout session after changing the shipping address.
Check the Coupons section.
Make sure the coupon code is entered correctly and that it is configured under the correct option:
Apply or remove the coupon and recalculate the shipping methods before testing again.
Check the Customer Groups setting.
Remember that NOT LOGGED IN customers are a separate customer group.
Test the same cart with the relevant customer group to confirm whether the rule is being applied correctly.
Check:
Make sure the server and Magento store time configuration are correct when testing time-based rules.
First make sure the rule has been saved.
Then clear the Magento cache:
bin/magento cache:flush
Refresh the checkout and recalculate the shipping rates.
If the website uses a CDN or another caching layer, clear that cache as well.
If the issue only happens in React Checkout Pro:
If the issue is still present, provide the following information when contacting support:
Before considering a shipping restriction ready for production, check the following: