User Tools

Site Tools


magento2:extensions:shipping-restrictions-extension

Shipping Restrictions Extension – User Guide

Extension Overview

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.

What this Extension Does

  • Create shipping restriction rules from the Magento Admin.
  • Restrict individual shipping methods or all methods from a carrier.
  • Use cart, product, and shipping address conditions.
  • Restrict shipping by state or province.
  • Apply rules to selected customer groups or stores.
  • Set restrictions for particular days and times.
  • Use coupon codes or shopping cart rules with a restriction.
  • Show a custom message when a shipping method is restricted.
  • Use {all-products} and {last-product} in the restriction message.
  • Support Magento checkout and React Checkout Pro.

Installation

Please refer to the installation guide in the following article:

Installation Guide

Admin Setup

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.

Shipping Restrictions Grid

The grid shows the shipping restriction rules configured in the store.

From the grid, you can:

  • View existing rules.
  • Create a new rule.
  • Edit an existing rule.
  • Manage the status of a rule.

Click Select to see the available actions for an existing rule.

Create a Shipping Restriction Rule

When you add a new rule, the configuration is divided into the following sections:

  • Shipping Methods
  • Conditions
  • Coupons
  • Stores & Customer Groups
  • Days & Time

1. Shipping Methods

This section is used to decide which shipping methods should be restricted when the rule matches.

Name

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

Status

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.

Restrict Shipping Methods

Enter the shipping methods that should be restricted.

Enter one method per line.

For example:

Table Rate

Restrict ALL METHODS from Carriers

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.

Error Message

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.

2. Conditions

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.

3. Coupons

The Coupons section can be used when the shipping restriction depends on a coupon or shopping cart rule.

Apply Restrictions Only With

Use this option when the restriction should only apply when a particular coupon or shopping cart rule is used.

You can specify:

  • Coupon Code
  • Shopping Cart Rule (discount)

Do NOT Apply Restrictions With

Use this option when the restriction should not be applied when a particular coupon or shopping cart rule is used.

You can specify:

  • Coupon Code
  • Shopping Cart Rule (discount)

4. Stores & Customer Groups

This section controls where the rule is applied and which customers are affected.

Admin Area

Set this option to Yes if the restriction should also be applied in the Magento Admin area.

Stores

Select the stores or store views where the rule should apply.

Leave the field empty if the rule should apply to any store.

Customer Groups

Select the customer groups that should be affected by the rule.

The list may include groups such as:

  • NOT LOGGED IN
  • General
  • Wholesale
  • Retailer
  • Other custom customer groups

Leave the field empty if the rule should apply to any customer group.

5. Days & Time

Use this section when the restriction should only be active on certain days or during specific hours.

Days of Week

Select the days when the rule should apply.

Available options are:

  • Sunday
  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday

Leave the selection empty if the rule should apply every day.

From

Select the time when the restriction should start.

To

Select the time when the restriction should end.

Make sure the Magento store time zone is correct when using time-based restrictions.

Save the Rule

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.

Example: Block Table Rate for New York

Here is a simple example of restricting a shipping method for customers shipping to New York.

  1. Create a new shipping restriction rule.
  2. Enter a name such as Block Table Rate for New York.
  3. Set Status to Active.
  4. Open the Conditions section.
  5. Set Shipping State/Province to New York.
  6. Open Shipping Methods.
  7. Enter the shipping method that should be restricted.
  8. Enter a customer-facing message, for example:
We do not ship to New York using this shipping method.
  1. Select the required store and customer groups if necessary.
  2. Save the rule.
  3. Test the rule from the storefront checkout.

User Experience

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:

  1. The customer adds products to the cart.
  2. The customer goes to checkout.
  3. The customer enters a shipping address.
  4. Magento calculates the available shipping methods.
  5. The extension checks the active shipping restriction rules.
  6. If a rule matches, the configured shipping method is restricted.
  7. If an error message has been configured, it can be shown to the customer.

If the customer changes the shipping address or other information so that the rule no longer matches, the shipping method can become available again.

Troubleshooting

If a shipping restriction is not working as expected, check the rule configuration first.

The restricted shipping method is still showing

Check the following:

  • Make sure the rule is Active.
  • Check the shipping method entered in the rule.
  • If a carrier is selected, make sure it is the correct carrier.
  • Check the conditions and test with an address/cart that should match the rule.
  • Check the selected store and customer group.
  • If the rule uses coupons or time settings, check those values as well.
  • Clear the Magento cache and try checkout again.

You can clear the Magento cache with:

bin/magento cache:flush

A shipping method is being blocked when it should not be

Check the active shipping restriction rules.

Another rule may be restricting the same shipping method.

Also check:

  • Conditions
  • Stores
  • Customer Groups
  • Coupons
  • Days & Time

If several rules apply to the same shipping method, review them together to find which rule is causing the restriction.

The rule is not working for a particular state

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.

The coupon condition is not working

Check the Coupons section.

Make sure the coupon code is entered correctly and that it is configured under the correct option:

  • Apply Restrictions Only With
  • Do NOT Apply Restrictions With

Apply or remove the coupon and recalculate the shipping methods before testing again.

The rule is not working for a particular customer

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.

The rule is not working at the expected time

Check:

  • Selected days
  • From time
  • To time
  • Magento store time zone

Make sure the server and Magento store time configuration are correct when testing time-based rules.

Changes are not visible at checkout

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.

Issue occurs only with React Checkout Pro

If the issue only happens in React Checkout Pro:

  • Test the same rule in React Checkout Pro.
  • Change the shipping address and check whether shipping methods are recalculated.
  • If possible, compare the result with the standard Magento checkout.
  • Check Magento logs if shipping rates are not being returned correctly.

Before Contacting Support

If the issue is still present, provide the following information when contacting support:

  • Magento version.
  • Shipping Restrictions Extension version.
  • Rule name and configuration.
  • Shipping carrier and method being tested.
  • Shipping address used for testing.
  • Customer group.
  • Coupon code, if applicable.
  • Whether the issue occurs in standard checkout, React Checkout Pro, or both.
  • Relevant Magento error or system log messages.

Quick Test Checklist

Before considering a shipping restriction ready for production, check the following:

  • [ ] Rule is Active.
  • [ ] Correct shipping method or carrier is selected.
  • [ ] Conditions are correct.
  • [ ] Store and customer group settings are correct.
  • [ ] Coupon settings are correct, if used.
  • [ ] Days and time settings are correct, if used.
  • [ ] Matching checkout scenario has been tested.
  • [ ] Non-matching checkout scenario has been tested.
magento2/extensions/shipping-restrictions-extension.txt · Last modified: by swatwik