Files
medusa-store/www/apps/resources/app/commerce-modules/fulfillment/shipping-option/page.mdx
T
Shahed Nasser 3298cd3fd2 docs: improved commerce module docs [2/n] (#9501)
Improve + add docs for commerce modules from currency to inventory

[2/n]
2024-10-09 09:53:17 +00:00

67 lines
3.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export const metadata = {
title: `Shipping Option`,
}
# {metadata.title}
In this document, youll learn about shipping options and their rules.
## Whats 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](/references/fulfillment/models/ShippingOption).
---
## Service Zone Restrictions
A shipping option is restricted by a service zone, limiting the locations a shipping option be used in.
For example, a fulfillment provider may have a shipping option that can be used in the United States, and another in Canada.
![A diagram showcasing the relation between shipping options and service zones.](https://res.cloudinary.com/dza7lstvk/image/upload/v1712330831/Medusa%20Resources/shipping-option-service-zone_pobh6k.jpg)
Service zones can be more restrictive, such as restricting to certain cities or province codes.
![A diagram showcasing the relation between shipping options, service zones, and geo zones](https://res.cloudinary.com/dza7lstvk/image/upload/v1712331186/Medusa%20Resources/shipping-option-service-zone-city_m5sxod.jpg)
---
## Shipping Option Rules
You can restrict shipping options by custom rules, such as the items weight or the customers group.
These rules are represented by the [ShippingOptionRule data model](/references/fulfillment/models/ShippingOptionRule). Its properties define the custom rule:
- `attribute`: The name of a property or table that the rule applies to. For example, `customer_group`.
- `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 rules values.
- To create a negation condition that considers `value` against the rule, use `nin`, which validates that the provided values arent in the rules values.
- Check out more operators in [this reference](/references/fulfillment/types/fulfillment.RuleOperatorType).
- `value`: One or more values.
![A diagram showcasing the relation between shipping option and shipping option rules.](https://res.cloudinary.com/dza7lstvk/image/upload/v1712331340/Medusa%20Resources/shipping-option-rule_oosopf.jpg)
A shipping option can have multiple rules. For example, you can add rules to a shipping option so that it's available if the customer belongs to the VIP group and the total weight is less than 2000g.
![A diagram showcasing how a shipping option can have multiple rules.](https://res.cloudinary.com/dza7lstvk/image/upload/v1712331462/Medusa%20Resources/shipping-option-rule-2_ylaqdb.jpg)
---
## Shipping Profile and Types
A shipping option belongs to a type. For example, a shipping options type may be `express`, while another `standard`. The type is represented by the [ShippingOptionType data model](/references/fulfillment/models/ShippingOptionType).
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 Property
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` property. It's an object that stores custom data relevant later when creating and processing a fulfillment.