Shipping Options
In this document, you’ll learn about shipping options and their rules.
What’s a Shipping Option?
A shipping option is a way of shipping an item. Each fulfillment provider provides a set of shipping options. For example, a provider may provide a shipping option for express shipping and another for standard shipping.
When the customer places their order, they choose a shipping option to be used to fulfill their items.
A shipping option is represented by the ShippingOption
data model.
Service Zone Restrictions
A shipping option is restricted by a service zone, which specifies in what locations can a shipping option be used.
For example, a fulfillment provider may have a shipping option that can be used in the United States, and another in Canada.
Service zones can be more restrictive, such as restricting to certain cities or province codes.
Shipping Option Rules
You can restrict shipping options by custom rules, such as the item’s weight or the customer’s group.
These rules are represented by the ShippingOptionRule
data model. Its attributes define the custom rule:
attribute
: The name of an attribute or table that the rule applies to. For example,customer_group
.value
: One or more values.operator
: The operator used in the condition. For example:- To allow multiple values, use the operator
in
, which validates that the provided values are in the rule’s values. - To create a negation condition that considers
value
against the rule, usenin
, which validates that the provided values aren’t in the rule’s values. - Check out more operators in this reference.
- To allow multiple values, use the operator
A shipping option can have multiple rules. For example, a shipping option is available if the customer belongs to the VIP group and the total weight is less than 2000g.
Shipping Profile and Types
A shipping option belongs to a type. For example, a shipping option’s type may be express
, while another standard
. The type is represented by the ShippingOptionType
data model.
A shipping option also belongs to a shipping profile, as each shipping profile defines the type of items to be shipped in a similar manner.
data Attribute
When fulfilling an item, you might use a third-party fulfillment provider that requires additional custom data to be passed along from the checkout or order-creation process.
The ShippingOption
data model has a data
attribute. It's an object that stores custom data relevant later when creating and processing a fulfillment.