User Tools

Site Tools


Sidebar

magento_2:shipping-restrictions

See how the Shipping Restrictions for Magento 2 extension works.

Ultimate Guide for Magento 2 Shipping Restrictions

Use numerous parameters (product, cart, customer attributes) as a base for shipping methods restrictions. Upgrade your shipping process: make it more flexible and effective.

  • Define a specific area of each shipping method application
  • Restrict shipping methods of particular carriers
  • Offer to customers different sets of shipping methods, depending on their purchase history
  • Choose the kind of orders, to which shipping restriction rules should be applied
  • Define special shipping methods to specific stores and customer groups
  • Hyva-ready storefront
  • Hyva Checkout ready
Magento 2 Shipping Restrictions extension is compatible with Hyvä themes. You can find the 'amasty/module-ship-restriction-hyva' package for installing in composer suggest (Note: the compatibility is available as part of an active product subscription or Support Subscription). The extension is also working properly with Hyvä Checkout.
The extension is compatible with Hyvä Checkout. You can find the amasty/module-ship-restriction-hyva-checkout' package for installing in composer suggest. The compatibility is available as a part of an active product subscription or support subscription.

:?: Any concerns about module configuration and implementation?

Book an individual training session to explore how the extension works and what practices to implement to achieve the desired result. Save time spent searching for the right settings - discuss configuration cases suitable for your business with the experts and work out the flow that your team needs.

In Shipping Restrictions FAQ you can find answers to the most popular questions about the extension functionality.

General Settings

Before configuring the restrictions, please go to Stores → Configuration → Amasty Extensions → Shipping Restrictions → General.

Here you can manage tax and discounts inclusion when your restriction is based on order subtotal.

Include tax in subtotal - set to Yes if you want to show subtotal with the tax included.

Use subtotal after discount - enable this option if you want the subtotal value to be used, considering the discounts applied.

Select the MSI Selection Algorithm - define the MSI algorithm that will be used for Source selection in the cart by default. It works only for shipping restrictions with the specified Source condition.


Restriction rule settings

The extension lets you create a big amount of shipping rules using various limitation criteria based on customers, cart and product attributes.

To manage shipping restrictions and create a restriction rule, go to Sales → Shipping Restrictions.

On the grid all the restriction rules are displayed. You can see the ID of the rules, their Status, Name, shipping Carriers and Methods, Customers Groups and Store Views in one place.

Manage all the created shipping restriction rules right on the grid. Edit them or Duplicate in the Action column.

To commit mass actions, select the rules and choose the action needed from the Actions dropdown menu. You can Delete the rules or Change Status to Activate / Inactivate in one click.

Creating the Restrictions

Click the Add Rule button to create a new restriction rule. To configure the rule, go to the Shipping Methods tab.

Shipping Methods

With the extension you can restrict Magento 2 shipping to a particular country or region, forbid the shipping of prohibited products, particular shipping methods, etc.

For example, you have a chance to significantly increase your sales by offering free shipping to all the customers except those, located in some area. In the case below we are creating the restriction rule for a specific country.

Restriction name - specify the name of a restriction rule, which will be used in the admin area. You will see it on the grid.

Restriction status - set to Active if you want the rule to be enabled.

Restrict Shipping Carriers and Methods - specify the list of shipping carriers you want to block. When the shipping carrier is selected, all its shipping methods will be restricted automatically. Also, the module allows to restrict only unnecessary shipping methods of the carrier instead of blocking all of them.

In this case, we’ve blocked all possible carriers and methods included.

Show restriction message - enable this setting to show a restriction message that will be displayed instead of a blocked shipping method.

Priority - set the priority for each rule. The priority is designated starting from 0, where a rule with a priority of 0 will execute first.

Discard Subsequent Rules - when this setting is activated, all other similar restriction rules will not be applied.

Custom restriction message - specify the restriction message that will be displayed instead of a blocked shipping method. Here you can add variables to the restriction messages, so then on the frontend they will be displayed to customers with the corresponding Carrier names or Delivery methods:

  • {delivery_method}
  • {delivery_name}
  • {restricted-products}
  • {last-restricted-product}
Please ensure that when configuring variables, you consider the conditions that are set. Therefore, it is important to configure restriction message variables in conjunction with restriction conditions to accurately inform customers about all shipping limitations.

Let's take an example: if you've applied restrictions based on both the country and specific products, make sure the variables you use in your Custom Restriction Message for both factors. If you only include product-related variables, customers will only see restrictions related to the products and won't be informed about country-specific limitations, even if they apply. This could lead to situations where a customer removes a restricted product from their cart, only to find out that delivery remains prohibited. This lack of clarity can leave them puzzled about the actual reason for the delivery decline. Hence, it's of utmost importance to align variables with the specified conditions to ensure transparent communication.

Show Restriction Message Once - select ‘Yes’ if you’d like to restrict the whole carrier and show one restriction message for it.

Priority - In our example, the customers will see the message if they choose Canada as a shipping country.


Conditions

In this tab set the conditions according to which the rule will be applied.

Condition tree - determines the conditions necessary to be met for the application of a rule. If no conditions are specified, the rule will be applicable to all products.

For example, to block shipping to a specific country, choose the Shipping Country condition in the Cart Attribute block. You may add shipping postcode, region, state/province if needed.

In case you want to set several independent conditions and you need any of them for the rule to be applied, change ‘All’ value to ‘Any’ in the dropdown menu.

The conditions may include Products Subselection, Conditions Combination, Cart Attributes, Advanced Conditions, Customer Attributes and Shipping Areas. Thus, in this option you can restrict shipping according to the product level and category, various customer attributes, custom groups, etc.

Also, we added a new condition for Inventory Source products in the Advanced Conditions category.

Source - select Sources this restriction will be applied to. On the checkout, sources will be automatically picked by the algorithm specified in Select the MSI Selection Algorithm setting.

Please note that if the shipment is created long after the order was placed, the system may pick the Source different from the one specified in conditions. It might happen if the item quantity in the Source is changed and is no longer enough to cover the order during creating a shipment.
See how to manage Shipping Areas here.

Backorders - specify the condition, when the rule should be applied, depending on the existence of Backorders in the cart.

Three options are available:

  • All orders - the rule is applied to all orders, regardless of whether the products in the cart include Backorders.
  • Backorders only - the rule is applicable when the cart contains only Backorders;
  • Non-backorders - the rule should be applied when the cart contains no Backorder items.

Usage Example #1

We are going to create a rule for freight shipping. According to our business needs, we offer freight shipping when the total weight is more than 200lbs. Also, for particular distant regions the total weight should be more than 250.

In the Shipping Methods tab we specify the restriction name, enable the rule, choose the carriers and the methods we want to block. Then we provide our customers with the restriction message.

It is also important to specify the conditions for the rule to be applied. As we have several independent conditions, we’ve set the rule according to which ANY of the conditions and condition combinations will restrict freight shipping.

Thus, freight shipping will be forbidden when total weight is under 200 for all areas and under 250 for distant regions.

Usage Example #2

With the extension you are able to create special shipping conditions even for certain customers using Customer Attributes such as date of birth, customer group, gender and so on if needed.

In the following case, we offer overnight shipping for the users from the main website, but we don’t accept credit cards as a payment methods.

We specified the restriction name, activated the rule, blocked specific methods (Federal Express Overnight) without blocking the whole carrier and filled in the restriction message.

Then we chose conditions combination for the restriction.

In the Conditions tab we restricted overnight shipping for the main website customers who specified a credit card as a payment method.


Coupons and discounts

Use this tab to limit some certain customer’s facilities and to disable or allow shipping with coupon.

For example, you have set your shop to automatically give Magento 2 free shipping when someone's subtotal is over $149, but if a customer uses a coupon that drops the order value below $149, free shipping wouldn’t be applied due to the discounted subtotal.

In the example below we restricted the shipping if the ‘BlackFridayNight’ coupon is applied and allowed with the ‘FreeShipping’ code by excluding the coupon from the rule.

Apply Rules Only With

Coupon Code - define the coupon code that should be entered by a customer, to activate the rule. The rule will be applied only after the coupon code is entered.

Shopping Cart Rule (discount) - specify the existing shopping cart rules if you want the rule to be activated when a coupon code from the lists of coupons of the specified rules is entered.

Do NOT Apply Rules With

Coupon Code - specify the coupon code, which will abolish the application of the rule, when entered by a customer.

Shopping Cart Rule (discount) - name the shopping cart rules to make the rule inactive, when a coupon code from the lists of coupons, set in the mentioned rules, is entered.

To make these options available, you need to create a coupon at your backend settings in Marketing / Cart Price Rules area first.

Stores & Customer Groups

In this tab you can use customer groups and store views as a restriction base.

Admin Area - disable this option if you do not want this rule to be applied in the Admin Area.

Apply In Stores - select the stores, to which the rule should be applied. Leave empty or select all to apply the rule to any store. This function is very useful if you’re working worldwide and have several online shops.

Apply For Customer Groups - define specific Customer Groups, to which the rule should be applied. For example, you can give access to Magento 2 free shipping method only to wholesale users. Leave empty or select all to apply the rule to any group.


Days & Time

The extension allows to set shipping restrictions on particular days. This option can be very useful if you don't deliver goods on weekends or on holidays.

To configure the schedule, expand the Days and Time tab.

Days of the Week - choose certain days of the week if you don’t want the rule to be applied throughout the week. Leave empty or select all to apply the rule every day.

Time From - Time To - choose the time interval of the validity of the rule.


Shipping Areas

To manage all the restrictions efficiently, arrange shipping destinations into areas and apply restriction rules to the whole area at once. Include or exclude from the area different countries, states, regions, cities, zip codes, etc. For example, you can easily block delivery for the distant regions by creating the appropriate shipping area that includes such destinations.

Go to Stores → Sales → Shipping Areas.

Create and easily manage all shipping areas on a handy grid, where you can see the Name, Description and Status of each area.

Edit or Delete a rule via Select dropdown menu in the Action column.

To perform mass actions, tick the rules and choose the necessary variant from the Actions dropdown. Delete, Duplicate or Change Status in one click.

To create a new area, hit the Add Shipping Area button.

Go to the General tab. In our example we create a custom area for distant UK regions.

Shipping Area Name - specify the title of the area. It will be displayed on the grid and in the restriction rules conditions.

Status - set to Active to enable the area.

Description - define additional information about the area: the cases of usage, regions included, etc. The description will be displayed on the grid as well.

Then specify the particular regions in the Area Conditions tab.

For Countries - choose All countries or Include/Exclude specific countries.

Countries - specify the countries you want to include in the area or exclude from. Use a handy dropdown menu and tick the countries needed.

For States/Regions - define all the states and regions or the areas to be included/excluded.

States/Regions - specify the states or regions and include in the area or exclude from.

For Cities - select All to add all cities to the area or Include/Exclude particular ones.

Cities - specify the particular cities.

For Zip/Postcode - just as in the previous option, Include or Exclude necessary Zip/Postcodes if needed. For example, you can specify a zip code that starts from ‘X’ or ends with ‘Y. Use a single postcode or a number of zip codes From - To.

For Shipping Address Line - choose All shipping address lines or specify the particular lines if Contains or Doesn’t contain is selected.

In our example we’ve created a shipping area that contains particular regions, but excluded several cities. We also included one single zip code and a range of zip codes, but excluded a specific address line out of the area.

Save the area.

Now you can easily add the necessary areas to your rule conditions and restrict shipping to these areas in one click.

Magento 2 Shipping Restrictions is compatible with Multi Address Checkout. Thus you can enable your customers to ship an order to multiple addresses during checkout, and determine the maximum number of addresses to which an order can be shipped.

Additional packages (provided in composer suggestions)

To make additional functionality available, please install the suggested packages you may need.

Available as a part of an active product subscription or support subscription:

  • amasty/module-ship-restriction-hyva - Install this package to ensure the Shipping Restrictions extension works with the Hyvä Theme.
  • amasty/module-ship-restriction-hyva-checkout - Install this package to ensure the Shipping Restrictions extension works with Hyvä Checkout.
  • amasty/module-shiprestriction-restricted-products - Install this package to configure the display of restricted products in the restriction message: {restricted-products} to show all products causing the restriction message, and {last-restricted-product} to display the last product added that caused the message.
  • amasty/module-shipping-restriction-subscription-functionality - Install this package to enable the assignment of priority to each rule and to discard subsequent rules.

Troubleshooting checklist

If the rule you’ve created doesn’t work, please, make sure, that:

  • there are no other active rules, that should not be applied: if two or more restrictions are in the active status, they will be applied contemporaneously;
  • the conditions are set correctly.

FAQ

How to make a shipping method available in the Admin Panel only?

How to block a delivery method for a USA state if cart contains a specific product?

How many postcodes can be added to the Shipping Area?

How to configure a Shipping Restriction that will be triggered on a specific day of the week?

How to configure a Shipping Restriction based on postcodes?

Show more articles →


Find out how to install the Shipping Restrictions for Magento 2 via Composer.

Rate the user guide
 stars  from 3 votes (Details)
magento_2/shipping-restrictions.txt · Last modified: 2024/09/10 14:07 by avronskaya