Shipping Discount API reference
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
Anchor link to section titled "Extension targets"The Shipping Discount API exposes the following targets:
Target | Output type | Description |
---|---|---|
purchase.shipping-discount.run |
FunctionRunResult | Outputs the shipping rate discounts |
The RunInput
object is the complete schema that your function can receive as input.
For a list of fields that the Shipping Discount API's Input
object accepts, refer to Input.
The following example shows an input query:
The following example shows the resulting input to the query:
FunctionRunResult
Anchor link to section titled "FunctionRunResult"The FunctionRunResult
object is the expected output
for the purchase.shipping-discount.run
target.
Unlike other discount Function APIs, the Shipping Discount Functions API FunctionRunResult
object doesn't have a DiscountApplicationStrategy
field. Instead, all discounts included in the
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
or generally using DeliveryGroupTarget
.
The FunctionRunResult
is ignored if individual shipping rates are targeted more than once.
The following function result includes one free shipping discount for the Standard shipping rate: