The Shipping Discount API enables you to create a new type of discount that is applied to one or more shipping rates at checkout. ## Extension targets The Shipping Discount API exposes the following [targets](/docs/apps/build/app-extensions/configure-app-extensions#targets): | Target | Output type | Description | | ------ | ----------- | ----------- | | `purchase.shipping-discount.run` | [FunctionRunResult](#functionrunresult) | Outputs the shipping rate discounts | ## Input The `RunInput` object is the complete schema that your function can receive as [input](/docs/apps/build/functions/input-output#input). For a list of fields that the Shipping Discount API's `Input` object accepts, refer to [Input](/docs/api/functions/reference/shipping-discounts/graphql/input). ### Example The following example shows an input query:

The following example shows the resulting input to the query:

## FunctionRunResult The [`FunctionRunResult`][FunctionRunResult] object is the expected [output](/docs/apps/build/functions/input-output#output) for the `purchase.shipping-discount.run` target. Unlike other discount Function APIs, the Shipping Discount Functions API [`FunctionRunResult`][FunctionRunResult] object doesn't have a `DiscountApplicationStrategy` field. Instead, all discounts included in the [`FunctionRunResult`][FunctionRunResult] are applied, as long as each of these discounts target the same shipping rate no more than once, whether by targeting it specifically using [`DeliveryOptionTarget`](/docs/api/functions/reference/shipping-discounts/graphql/common-objects/deliveryoptiontarget) or generally using [`DeliveryGroupTarget`](/docs/api/functions/reference/shipping-discounts/graphql/common-objects/deliverygrouptarget). The [`FunctionRunResult`][FunctionRunResult] is ignored if individual shipping rates are targeted more than once. [FunctionRunResult]: /docs/api/functions/reference/shipping-discounts/graphql/functionrunresult ### Example The following function result includes one free shipping discount for the Standard shipping rate: