# Shipping methods

Shipping methods are used to provide customers with different delivery options.

Shipping methods are defined by currency and can be restricted to an active [market](/core-api-reference/markets.md) (in the latter case the currency is inherited by the market's price list).

* Set the `shipping_category` relationship if you want the shipping method to be available only if the items to be shipped belong to a specified [shipping category](/core-api-reference/shipping_categories.md).
* Set the `shipping_zone` relationship if you want the shipping method to be available only if the shipping address belongs to a specified [shipping zone](/core-api-reference/shipping_zones.md).
* Set the `stock_location` relationship if you want the shipping method to be available only if the items are shipped from a specific stock location.
* Specify a value for the `tax_code` attribute if you want to use a custom tax code for your shipments tax calculation (currently supported by [Avalara](/core-api-reference/avalara_accounts.md) only).
* Specify a value for the `min_weight` and/or `max_weight` attributes (to do that also a `unit_of_weight` must be defined) if you want the shipping method to be available only if the total weight of the items to be shipped falls within those values.

{% hint style="info" %}
The total weight of the shipment is automatically calculated from the single weights of the items included (i.e. the `weight` attribute of the [SKUs](/core-api-reference/skus/object.md) to be shipped).
{% endhint %}

## Default shipping method

A shipping method that is not already associated with any market, stock location, shipping category, or shipping zone can be set as the [default shipping method](/core-api-reference/markets.md#default-shipping-method) for one or more markets. To do that:

* [Create](/core-api-reference/shipping_methods/create.md) a new shipping method and keep it as more generic as possible by setting the required parameters only:
  * `name`
  * `currency_code`
  * `price_amount_cents`
* Now you can set that shipping method as the default for one or more markets as long as they are associated with a price list in the same currency.

In this case, [shipping weight tiers](#shipping-weight-tiers) (if any) will be ignored.

## Shipping method cost

### Free over amount

Each shipping method can have a price and can be free over a specific order's total amount. Set the `use_subtotal` attribute to `true` (default is `false`) if you want to compare the free over amount with the order's subtotal and exclude other discount calculations (if any).

### Shipping weight tiers

Set the proper value for the `scheme` attribute (default is `flat`) to define how you want to manage the shipping method cost:

* `flat` — the shipping method has a fixed price (equal to the value of the `price_amount_cents` attribute).
* `weight_tiered` — the shipping method price is [tiered](/core-api-reference/shipping_method_tiers.md) based on the total weight of the items included in the shipment (a maximum of **5** tiers for each shipping method is currently supported). See [shipping weight tiers](/core-api-reference/shipping_weight_tiers.md) to learn more.
* `external` — the shipping method price is fetched [from an external service](/core/external-resources/external-shipping-costs.md) which handles the custom calculation, overriding the `price_amount_cents` set at creation time (remember to specify the `external_prices_url` when creating or updating the shipping method).

{% hint style="info" %}
If a `free_over_amount` was specified, it applies regardless of the tier. If a `min_weight` and/or `max_weight` value for the shipping method's availability was specified, only the tiers between those values will be considered.
{% endhint %}

### Shipping cost cut-off

If you want to apply a [custom shipping cost policy](/core-api-reference/markets.md#market-specific-shipping-costs-policy) (e.g. charging your customers with one single shipping cost for the whole order) you can set to 0 the unit amount of some of the line items of type `shipments` that are created when a shipping method is associated with an order's shipments. To do that, leverage the dedicated attribute at the market level.

<details>

<summary>Data model</summary>

Check the related [ER diagram](/data-model/shipping/shipping-zones-and-methods.md) and explore the flowchart that illustrates how the shipping method resource relates to the other API entities.

</details>

<details>

<summary>How-to</summary>

Check the related [guide](/how-tos/placing-orders/checkout/selecting-a-shipping-method.md) to learn how to let a user choose one of the available shipping methods during the checkout. Learn how to manage the shipping methods cost [via external services](/core/external-resources/external-shipping-costs.md).

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.commercelayer.io/core-api-reference/shipping_methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
