Here a basic example of how to set up various shipping rate options. When you have certain conditions that depend on Country where you only want to offer a single option, then use OptionExit so that no other options are evaluated. When you want to offer multiple options, then use Option - each condition expression is evaluated, and if true, then the option is presented to the customer. A typical example would be when you want to offer Ground, Next day, etc.
Example requirements:
Order | Type | Name | Expression | Rate Expression |
100 | String | Country | ShippingAddress.Country.TwoLetterIsoCode |
|
110 | String | State | ShippingAddress.StateProvince.Abbreviation |
|
200 | OptionExit | International | !("US,CA".Contains([Country])) | 100 |
210 | OptionExit | Canada | [Country] = "CA" | 55 |
220 | OptionExit | Hawaii & Alaska | "AK,HI".Contains([State]) | 55 |
300 | Option | Free Ground Shipping | [$SubTotalWithDiscounts] > 100 | 0 |
310 | Option | Ground | [$SubTotalWithDiscounts] <= 100 | 15 |
320 | Option | Next Day Air | true | 95 |
330 | Option | 2 Day Air | true | 85 |
340 | Option | 3 Day Air | true | 75 |
Also, check out the first part of this blog I.e. you need to use ErrorExit to check for country/state as the initial record, because if in Estimate Shipping the customer does not choose a Country or State it will cause an error in the above references.
You can leave out the zip code check based on above conditions:
ShippingAddress.Country = null or ("US,CA".Contains(ShippingAddress.Country.TwoLetterIsoCode) and ShippingAddress.StateProvince = null)