DOCS

Restrict shipping options

/

Shipment rating rules

Control when shipping options are available in your checkout.

GraphQL

Advanced rules provide you with the tools to finely adjust your shipping choices, considering factors like weight, delivery location, item value, or SKU. Create rules to make shipping services available under the right circumstances and hidden when not wanted.

Conditions on flat rates: If you're using flat rate shipping options, consider building conditions for weight or cart value directly into the flat rate shipping conditions, rather than creating an advanced rule.

By weight 

Use advanced rules to set weight restrictions for your shipping service levels. This is particularly useful when you have set up a custom service via rate sheet and it has specific weight limitations. While Zonos knows the weight limitations of connected shipping services, we do not know weight limitations of any custom services you set up via a rate sheet. Ask your custom carrier for any weight limitations and apply them via an advanced rule.

Example: Don't show shipping option for orders under 4.4 lbs

Imagine you have added DHL Packet International as a shipping option via a rate sheet. This shipping service is not available for orders that weigh less than 4.4 lbs. You need to restrict DHL Packet International from appearing as a shipping option when the order weighs less than 4.4 lbs. To do so, enter the following inputs as variables in the createRule mutation.

Variables

1
2
3
4
5
6
7
8
9
{
  "input": {
    "name": "Restrict shipping under 4.4 lbs",
    "description": "Turn off shipping service level when the order weighs less than 4.4 lbs",
    "condition": ":weight: < 4.4 pound and :service_level_name: any_contains \"DHL Packet International\"",
    "action": "enabled = false",
    "context": "SHIPMENT_RATING_BUFFER"
  }
}

By address 

Advanced rules can also help you create address restrictions for your shipping service levels. You can use address limitations to:

  • Apply service restrictions to rate sheets—While connected shipping services directly ask the carrier if the service is available to a certain address, services set up via rate sheet will always return the shipping rate associated with the destination country. If the service is unavailable to certain postal codes (often remote areas), create a rule to not allow that shipping option to that postal code.
  • Show free shipping only to selected users—Have you ever wanted to offer free shipping to a specific shopper, like an influencer or wholesaler? By limiting shipping options based on the address, you can ensure that free shipping is exclusively available to the individuals you want to target.

Example: Make shipping unavailable to certain postal codes

Suppose you added a custom shipping option called "Express" that does not ship to remote postal codes in Canada, like X0A 0A0. Enter the following inputs as variables in the createRule mutation.

Variables

1
2
3
4
5
6
7
8
9
{
  "input": {
    "name": "Restrict shipping",
    "description": "Do not allow rate sheet to be a shipping option when the postal code is X0A 0A0",
    "condition": ":service_level_name: any_contains \"Express\" and :ship_to_postal_code: == 'X0A 0A0' and :ship_to_country: == CA",
    "action": "enabled = false",
    "context": "SHIPMENT_RATING_BUFFER"
  }
}

Example: Offer free shipping only to select shoppers

Let's say you have an influencer who often buys from you and you want to offer them free shipping, but you don't want other shoppers to get free shipping. You've set up a free shipping rule in your shipping settings, and your next step is to restrict it to just your influencer's address. Enter the following inputs as variables in the createRule mutation.

Since the same address line 1 can exist in multiple areas, it is wise to pair it with a postal code. However, this does not work well if you want to allow multiple addresses in different postal codes. If you would like to do so, please let us know, so we can prioritize building this capability for you.

Variables

1
2
3
4
5
6
7
8
{
  "input": {
    "name": "Restrict free shipping",
    "description": "Turn off free shipping when the address is anywhere but 123 Main St in the postal code 12345.",
    "condition": ":service_level_name: == \"Free shipping\" and :ship_to_line_1: none_matches '123 Main St' and :ship_to_postal_code: none_matches '12345'",
    "context": "SHIPMENT_RATING_BUFFER"
  }
}

By item value 

High-value goods often warrant additional considerations when shipping internationally. Use advanced rules to force quicker shipping options, allow free shipping options, and restrict carts to avoid filing EEIs.

  • Shipping speed—You often want to ensure they ship quickly to reduce the risk of issues during transit. If you sell both high- and low-value goods, you may want to offer different shipping options based on the value of the order.
  • Free shipping—Alternatively, you may want to only show a free shipping option when the order is over a certain amount. You can already build in value conditions for free shipping when you set up the free shipping rule. However, if you want to hide all other shipping options when free shipping applies, create a rule to do so.
  • Avoid filing EEIs—If you want to avoid filing EEIs due to the hassle, you may decide to not allow any shipping options when the cart is over 2500 USD. Since Canada does not require EEIs, you could write the rule to still allow high value orders to Canada.

Example: Remove all options except Free Shipping

Let's say you have created a free shipping option for orders over 150 USD. You want to hide other shipping options (Express and Priority) when this service is available. Enter the following inputs as variables in the createRule mutation.

Variables

1
2
3
4
5
6
7
8
9
{
  "input": {
    "name": "Only show free shipping over 150 USD",
    "description": "Turn off all other shipping service levels when the order value is more than 150 USD",
    "condition": ":items_total: > 150 USD and :service_level_name: ne \"Free Shipping\"",
    "action": "enabled = false",
    "context": "SHIPMENT_RATING_BUFFER"
  }
}

Example: Turn off all shipping options over 2500 USD

Suppose you offer Express and Priority services, but you do not want them to be an option in the checkout for any orders over 2500 USD. You do still want to allow orders over 2500 USD to Canada, since Canada does not require EEI filings. Enter the following inputs as variables in the createRule mutation.

EEIs are generally needed when the value of items with the same HS code exceed 2500 USD (not necessarily when the order exceeds 2500 USD, as you could have a 2500 USD order with two different items, each 1500 USD). With that in mind, the rule below does not perfectly align with EEIs, but will restrict shipping options when they are needed. It may also restrict shipping options when the EEI was not needed (as in two diffferent items, each worth 1500 USD).

Variables

1
2
3
4
5
6
7
8
9
{
  "input": {
    "name": "Restrict all shipping over 2500 USD",
    "description": "Turn off all shipping service levels when the order value is more than 2500 USD, except to Canada",
    "condition": ":amount: > 2500 USD and :service_level: any_contains \"Express,Priority\" and :ship_to_country: ne CA",
    "action": "enabled = false",
    "context": "SHIPMENT_RATING_BUFFER"
  }
}

By SKU 

Note: Country restrictions by SKU should be managed in Catalog. Advanced rules should only be used when Catalog is not sufficient (such as conditions that are specific to the shipping service level).

If you want certain items to only use a particular shipping option, create an advanced rule to disable all other shipping options when that SKU is the in cart.

Example: Restrict SKU from using Express shipping

Let's say you do not want your item with SKU 123456 to ship via your shipping service level Express. Enter the following inputs as variables in the createRule mutation.

Variables

1
2
3
4
5
6
7
8
9
{
  "input": {
    "name": "Restrict shipping for items",
    "description": "Turn off shipping service level when certain item is in the cart",
    "condition": ":items.sku: any_matches '123456' and :service_level: any_contains \"Express\"",
    "action": "enabled = false",
    "context": "SHIPMENT_RATING_BUFFER"
  }
}

Customizations 

The examples in this document can be altered to fit your specific scenario. When you adjust the actions and conditions, first verify that are written correctly before implementing the rule. Use the validate mutation to ensure the proper syntax is used. Enter the action and condition separately as the expression and ensure the correct ruleContext is used.

Mutation

1
2
3
4
5
6
7
8
mutation validate {
  validateExpression(
    input: {
      expression: ":items_total: > 150 USD and :service_level_name: ne \"Free Shipping\""
      ruleContext: "SHIPMENT_RATING_BUFFER"
    }
  )
}

Was this page helpful?