Prevent Shipping to a Zone for Certain Items

Overview

Let’s say you wish to prevent shipping alcohol to certain states.  ShipperHQ fully supports this.

Pre-Requisites: You need first to set up your carriers and origin(s) in ShipperHQ.  Let’s assume this is done and you have a UPS carrier, and 1 origin (which is where you dispatch from).

Define Zone

Before setting the rule, you need to create and define the zone that the alcohol can ship to. See steps for Zones Configuration here.

Define Shipping Group

You also need to set up a shipping group. Shipping groups allow you to categorize goods together so that you can apply rules to them. See steps for Shipping Group Configuration here.

In this scenario we need a shipping group ALCOHOL.  Personally we recommend using capitals just as it makes it less likely to misspell them.

Setup

There are 2 ways to set this kind of rule up: restriction on shipping group directly, or by carrier rule.

SETUP A: Use Shipping Group to Prevent Shipping to Zone

With shipping groups you can restrict the zones they display rates to. In this case we don’t want to show shipping to certain states.

  1. Edit the Shipping Group you defined above. In our example, that’s the ALCOHOL group.
  2. In the Optional panel, under the Restrict to Zones dropdown, select the Zone you created that alcohol can ship to. (See screenshot)
  3. Only set the “Restrict to Shipping Methods” section if you want this group to show certain methods only (i.e. show ground only)
  4. Don’t worry about Advanced Settings
  5. Save the group

Please Note: When a shipping group has a zone defined in “Restrict to Zones” no other zones will be eligible, regardless of the other items in the cart. This combines with other shipping group restrictions, so if you have one group in the cart that can only ship to NY and one that can only ship to CA they will both cancel each other out an no rates will be displayed.

SETUP B: Use Carrier Rule to Prevent Shipping to Zone

With carrier rules against a shipping group, you can hide rates when the group is in the cart. This accomplishes the same setup as above, but allows for more conditional flexibility.

    1. Go to Carrier Rules > +Add New
    2. In the Basic panel, Name the rule (i.e. Prevent shipping ALCOHOL to certain states)
    3. Under Shipping Methods panel, choose all methods. This is because you want to prevent all rates to certain zones.
    4. Under Conditions find the dropdown for Apply to Zones > choose the Alcohol Friendly Zone you created in the beginning
    5. Still under Conditions, find the Must include all these Shipping Group(s) dropdown > choose your product group. In our case, ALCOHOL.
    6. Under Actions panel, find Action to Perform dropdown > choose Hide Shipping Methods

NOTE: For Magento 1 and 2 there is a checkbox for “Show Error Message when this Rule Applies”. If ticked, you can enter a custom error message when this rule applies. This is useful if, for example, you want to display a message to the customer along the lines of “Alcohol cannot be shipped to your destination”.

Assign Products to their Shipping Groups

Be sure to assign your relevant products to the new group before you test. For this example, you will see that rates for ALCOHOL are returned for alcohol friendly states defined in your zone, and no rates will return when ALCOHOL is in the cart for non-alcohol friendly states.