User Tools

Site Tools


Sidebar

magento_2:shipping-rules

For more details see how the Shipping Rules for Magento 2 extension works.

Guide for Shipping Rules for Magento 2

Achieve your goals by managing shipping conditions according to your demands.

  • Create shipping rules depending on purchases history, cart or customer attributes
  • Apply individual rules to specified shipping methods and shipping carriers
  • Define a selection of shipping carriers, available to your customers, and manage their shipping rates
  • Change the rate for the whole cart both by fixed amount and by percent
  • Choose specific days or periods of the rules validity
  • Hyva-ready storefront
  • Hyva Checkout ready
Magento 2 Shipping Rules extension is compatible with Hyvä themes.You can find the 'amasty/module-shipping-rules-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-shipping-rules-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.

☝ BOOK INDIVIDUAL TRAINING

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

General extension settings

Extension settings are located at Stores > Configuration > Amasty Extensions > Shipping Rules

Include tax in subtotal - indicate whether the subtotal includes taxes.

Use subtotal after discount - set to Yes, if the subtotal should contain prices after the discount; set to No, if the subtotal should contain only original prices.

Effectively deal with all stages of RMA process to organize the efficient process of returning products.

Shipping rule settings

Shipping Rules are set up in Sales → Shipping Rules.

All rules are displayed on a handy grid. You can see the ID of the rules, their Priority, Status, Name, shipping Carriers and Methods, Customers Groups, type of Calculation and Store Views in one place.

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

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

To create a new rule, click the Add Rule button.

Shipping Methods

The extension allows to set an unlimited number of various rules according to shipping carriers, countries, specific products, schedule, particular conditions, etc.

Rule Name - specify the name of the shipping rule, which will be used in the admin area. Rule Name is also displayed on the grid.

Rule Status - define the rule as active or inactive.

Shipping Carriers and Methods - choose shipping carriers to which the rule should be applied and determine the list of available shipping methods.

The module allows to choose particular shipping methods without choosing the whole carrier. .

Customize Name - If this setting is enabled, admins can customize the names of the carrier and shipping methods. Please, note, that his functionality is available as part of an active product subscription or support subscription.

When the Custom Name option is enabled, the following fields will be displayed: Carriers and Methods field will display the options that are selected in the “Shipping Carriers and Methods” setting and are active for the specific shipping rule: Custom Name - If a custom name is specified in this field, the method will be shown with that name only for this rule. In other rules where no custom name is provided, the default name will be displayed. It is also possible to choose both the carrier and the method.

Rule Priority - define the importance of the rule. The higher the rule priority is, the earlier the rule will be applied in comparison with others.

Keep in mind, that when two or more rules are applied to a shipping rate of a product simultaneously, the customers will see the rate, provided by the rule with the lowest priority. Check this block to get more information.

Discard Subsequent Rules - enable this option to stop the rules with lower priority.


Products

This option is unavailable for the Replace calculation type, since in this type shipping rates are replaced for the whole cart, regardless of the products in it.

Specify the conditions according to which the rule will be applied.

Ignore Free Shipping Promo - set to Yes, if you want the rule to be applied to all products, including free shipping promo items; set to No, if the rule should be applied only for items with non-free shipping.

Weight/Qty/Price - The rule will be applied if Price/Weight/Qty conditions reach the specified values for selected products in the cart. Leave empty if you don’t have any specific conditions.

Please note, that we corrected the shipping rules' logic and optimized their calculation. Now the shipping cost of products in the mixed cart is calculated only for items that comply with the conditions of created rules. The shipping calculation doesn't include products that don't fit the conditions.

Rates

In this tab you can set the necessary rates.

Calculation - set to:

  • Replace - if you want the original shipping rate for the whole cart to be changed to another value;
  • Surcharge - to add the calculated value to the present shipping rate;
  • Discount - if you want to deduct the calculated value from the present shipping rate;
  • Partial Replace - if you want the original shipping rate to be changed to another value by additional product conditions (mixed cart).
How does it work?

If you want to apply particular shipping cost for specific products, select Partially Replace type and set the necessary product conditions according to which this calculation type will be applied. Thus, shipping cost for the specified products in a mixed cart will be calculated differently and the total sum for shipping will be recounted.

Base Rate for the Order - determine the total rate per order.

Fixed Rate per Product - specify a fixed rate for each product in the cart. The rate for the whole order will be formed by multiplying the mentioned fixed rate by the number of products in the cart.

Rate per unit of weight - define a rate that will be automatically multiplied by the products’ weight to create a shipping rate. For example, if you set $5 rate per unit of weight (regarding that a unit of weight equals to 1 kilo), then the rate for the order, containing 5 kilos of products of the mentioned category (without products of other categories), will constitute $25.

Percentage per Product - determine the rate as a percentage of the original cost of products in the cart (the costs are taken without any discounts that might have been applied).

Handling Percentage - specify the percentage that will be automatically added or deducted from the shipping rate. The percentage will be calculated on the original shipping rates basis.

Minimal\Maximal Rate Change - set boundary (minimal or maximal) values, for which the original rate can be changed.

Minimal\Maximal Total Rate - determine boundary (minimal or maximal) values of a shipping rate which can be set after the rule application.


Conditions

Specify the conditions according to which the rule will be applied.

Condition tree - if there are some conditions specified, the rule will be applied only when the conditions are met. If there are no conditions set, the rule will be applicable all the time.

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

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.

Backorders - the option determines how the rule will work if there are Backorder items in the cart.

  • Backorders only - the rule is applied when there are only Backorder items in the cart.
  • Non backorders - the rule works when there are no Backorder items in the cart.
  • All orders - the rule works regardless of whether there are Backorder items in the cart or not.

Stores & Customer Groups

In this tab you can configure rules application for different store views and customer groups.

Admin Area - enable or disable the rule application in the admin area.

Stores - specify the stores where the rule should be applied.

Customer Groups - define customer groups, to which the rule should be applied.

Please note that if nothing is specified in Stores and Customer Groups conditions, the rule will be applied to all stores and customer groups accordingly.

Days & Time

Expand this tab to choose particular days of the week and time for the rule to be applied.

Days of the Week - choose separate days of the week if you don’t want the rule to be applied the entire time.

Time From - Time To - determine the specific validity period of the rule.


Coupons

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

Apply Rules Only With

Coupon Code - when a coupon is provided here, the rule will be activated only when this coupon is entered.

Shopping Cart Rule (discount) - works the same as the setting above, but uses the list of coupons in the selected rules instead of a single coupon.

Do NOT Apply Rules With

Coupon Code - when a coupon is provided here, the rule won't work when this coupon is entered.

Shopping Cart Rule (discount) - works the same as the setting above, but uses the list of coupons in the selected rules instead of a single coupon.

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

Shipping Areas

The module allows to arrange shipping destinations into areas and apply 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 configure delivery to 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 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 configure shipping to these areas in one click.
Magento 2 Shipping Rules 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.

Usage example

Example #1

We are going to create a rule, according to which free shipping is allowed only when the total weight is equal or below 4 kg. In case the total weight is more than the limit, +1$ for each kg is added.

So we specify rule name, carriers, methods, priority and activate it.

Then we need to expand Rates tab and choose Surcharge in the Calculation option so that to add extra sum.

Set the necessary rate per unit.

In the Conditions tab we specify the particular total weight that is needed for the rule to be applied.

Example #2

In this case the rule will provide wholesale customer group with a 10% discount per each product.

We configure the general setting of the rule.

In the Rates tab we need to specify Percentage per Product. It is also possible to set maximum value for which the original rate can be changed.

And finally we select a particular customer group to which the rule should be applied.

Thus, combining all the options and conditions, we can create all necessary rules to achieve our business goals.


Example #3

In this case, we’ll trigger two rules according to their priority and see how they work combined.

Configure Rule 1 the following way and set Priority 2:

Then set up Rule 2 this way and specify Priority 4: Once done, add two items in the cart: 1 - product from the category Bags; 2 - product from any other category.

On the checkout page, you will see that the rules are triggered one after another:

  1. Rule with the higher priority (Rule 1) is triggered first, and shipping for the whole cart becomes $10.
  2. Then the rule with the lower priority (Rule 2) works out. Shipping for the product from category Bags becomes $5.

After that, the system sums up shipping for both items in the cart: $10+$5=$15. Overall, shipping for the whole cart is $15.

Import and Export

With the extension, you can import and export such Shipping Rules data like Rules, Rules Attributes, Customer Groups, Rules Days and Rules Stores. This functionality is available as a part of an active product subscription or support subscription.

To import blog data, please navigate to System → Amasty Import → Import → Select Entity → Amasty Shipping Rules → Shipping Rules:

Then adjust other settings for the import according to your needs.

To export Shipping Rules data, please navigate to System → Amasty Export → Export → Select Entity → Amasty Shipping Rules → Shipping Rules:

Then adjust other settings for the export according to your needs.

Shipping Area Import

You also can import Shipping Area data. Please navigate to System → Amasty Import → Import → Select Entity → Amasty Shipping Area → Shipping Area.

Then adjust other settings for the import according to your needs.

Shipping Area Export

To Export Shipping Area data please navigate to System → Amasty Export → Export → Select Entity → Amasty Shipping Area → Shipping Area.

Then adjust other settings for the export according to your needs.


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-shipping-rules-hyva - Install this package to ensure the Shipping Rules extension works with the Hyvä Theme.
  • amasty/module-shipping-rules-hyva-checkout - Install this package to ensure the Shipping Rules extension works with Hyvä Checkout.
  • amasty/module-ship-rules-export-entity - Install this package for Shipping Rules Export compatibility.
  • amasty/module-ship-rules-import-entity - Install this package for Shipping Rules Import compatibility.
  • amasty/module-ship-rules-import-entity - Install this package for Shipping Rules Import compatibility.
  • amasty/module-ship-rules-name-customization - This package provides the ability to customize Shipping Carrier and Method names.

Troubleshooting checklist

Please review the information below to figure out why the rule you've set up doesn't work or works incorrectly.

Check if conditions are specified correctly

One of the most common reasons, that shipping rules either don’t work properly or don’t work at all, is incorrectly set conditions.

The problem may arise because Magento will search for a product with the specified single SKU (in our example the SKU is “23rf,29rt,300ds”) in the cart, not any of the products with the SKUs from the list: 23rf, 29rt or 300ds. If you’ve meant the second requirement (one of the products from the list), you should configure the rule in the way presented below.

Consider the difference: conditions specified on the Products tab and on Conditions tab

  • Conditions tab defines the cases when the rule should be used.

  • Products tab specifies the products to which the rules should be applied.

Now let’s check how the rule presented above works: when the cart contains 3 or more products with SKUs 23rf, 29rt or 300ds, the shipping rates will be replaced with $0 only for products with the mentioned SKUs. Shipping rates of products with other SKUs in the cart won’t be changed when the rule activates.

Check if there are no other activated rules that are not needed

To avoid undesirable results, make sure there are no active rules that shouldn't be applied. Let’s check the situation: you have several shipping rules and all of them are set as active. Rule 1 has the highest priority, Rule 2 has lower priority and Rule 3 has the lowest one. That’s how it will work when the cart contents meet all active shipping rules conditions:

  • Rule 1 will be applied first. It is set to replace a shipping rate of any one item in the cart with $0.50.
  • Rule 2 will be applied the second. It replaces the cost of shipping for the whole order with $15.
  • Rule 3 will be applied the last. This rule sets free shipping for all items in the cart. This means, that shipping rate for the whole order will constitute $0.

Use Conditions tab to restrict the cases of the rule application.

FAQ


Find out how to install the Shipping Rules for Magento 2 via Composer.
Rate the user guide
 stars  from 3 votes (Details)
magento_2/shipping-rules.txt · Last modified: 2024/09/11 11:10 by avronskaya