The Shipping Discount API enables you to create a new type of discount that's applied to one or more shipping rates at checkout.

## Example use cases

- Free shipping.
- A discount on shipping. For example, 20% off shipping or $5 off shipping.
- A discount on specific shipping rates. For example, 50% off Standard shipping.

## Developer tools and resources

<div class="resource-card-grid">
  <div>
  <a class="resource-card" href="/docs/apps/build/cli-for-apps" data-theme-mode="">
    <div class="resource-card__indicator-container"><img
     src="/assets/resource-cards/cli"
     data-alt-src="/assets/resource-cards/cli-dark"
     aria-hidden="true"
     class="resource-card__icon themed-image"></div>
    <h3 class="resource-card__title">
      Shopify CLI
    </h3>
    <p class="resource-card__description">A command-line tool for building Shopify apps.</p>
  </a>
</div></p>

<p><div>
  <a class="resource-card" href="/docs/api/functions/reference/shipping-discounts/graphql" data-theme-mode="">
    <div class="resource-card__indicator-container"><img
     src="/assets/resource-cards/graphql"
     data-alt-src="/assets/resource-cards/graphql-dark"
     aria-hidden="true"
     class="resource-card__icon themed-image"></div>
    <h3 class="resource-card__title">
      Shipping Discount API reference
    </h3>
    <p class="resource-card__description">Consult the GraphQL reference for the Shipping Discount API.</p>
  </a>
</div>
</div>


## Migrating from scripts to functions

If you want to migrate an existing [shipping script](https://help.shopify.com/en/manual/checkout-settings/script-editor/shopify-scripts) to Shopify Functions, then you can use the following mapping:

| Shopify Scripts method | Description | Shopify Functions object |
| ------------ | ----------- | -------------- |
| `apply_discount` | Applies a discount to a shipping rate | [Shipping discounts](/docs/api/functions/reference/shipping-discounts/graphql/functionrunresult) |

## Next steps

- Learn how to use Shopify Functions by [building a discounts experience](/docs/apps/build/discounts).