--- title: Discounts description: The API for interacting with discounts. api_version: 2025-10 api_name: checkout-ui-extensions source_url: html: https://shopify.dev/docs/api/checkout-ui-extensions/latest/apis/discounts md: https://shopify.dev/docs/api/checkout-ui-extensions/latest/apis/discounts.md --- # DiscountsAPI The API for interacting with discounts. ## StandardApi The base API object provided to `purchase` extension targets. * discountAllocations SubscribableSignalLike\ required Discounts that have been applied to the entire cart. * discountCodes SubscribableSignalLike\ required A list of discount codes currently applied to the checkout. ### SubscribableSignalLike Represents a read-only value managed on the main thread that an extension can subscribe to. Example: Checkout uses this to manage the state of an object and communicate state changes to extensions running in a sandboxed web worker. This interface is compatible with \[Preact's ReadonlySignal]\(https\://github.com/preactjs/signals/blob/a023a132a81bd4ba4a0bebb8cbbeffbd8c8bbafc/packages/core/src/index.ts#L700-L709). Some fields are deprecated but still supported for backwards compatibility. In version 2025-10, \[\`StatefulRemoteSubscribable\`]\(https\://github.com/Shopify/remote-dom/blob/03929aa8418a89d41d294005f219837582718df8/packages/async-subscription/src/types.ts#L17) was replaced with \`ReadonlySignalLike\`. Checkout will remove the old fields some time in the future. * current ```ts T ``` * destroy ```ts () => Promise ``` * subscribe ```ts (fn: (value: T) => void) => () => void ``` * value ```ts T ``` ```ts export interface SubscribableSignalLike extends ReadonlySignalLike { /** * @deprecated Use `.value` instead. */ readonly current: T; /** * @deprecated No longer needed. Use Preact Signal management instead. */ destroy(): Promise; } ``` ### CartDiscountAllocation ```ts CartCodeDiscountAllocation | CartAutomaticDiscountAllocation | CartCustomDiscountAllocation ``` ### CartCodeDiscountAllocation * code The code for the discount ```ts string ``` * discountedAmount The money amount that has been discounted from the order ```ts Money ``` * type The type of the code discount ```ts 'code' ``` ```ts export interface CartCodeDiscountAllocation extends CartDiscountAllocationBase { /** * The code for the discount */ code: string; /** * The type of the code discount */ type: 'code'; } ``` ### Money * amount The price amount. ```ts number ``` * currencyCode The ISO 4217 format for the currency. ```ts CurrencyCode ``` ```ts export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } ``` ### CurrencyCode ```ts 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' ``` ### CartAutomaticDiscountAllocation * discountedAmount The money amount that has been discounted from the order ```ts Money ``` * title The title of the automatic discount ```ts string ``` * type The type of the automatic discount ```ts 'automatic' ``` ```ts export interface CartAutomaticDiscountAllocation extends CartDiscountAllocationBase { /** * The title of the automatic discount */ title: string; /** * The type of the automatic discount */ type: 'automatic'; } ``` ### CartCustomDiscountAllocation * discountedAmount The money amount that has been discounted from the order ```ts Money ``` * title The title of the custom discount ```ts string ``` * type The type of the custom discount ```ts 'custom' ``` ```ts export interface CartCustomDiscountAllocation extends CartDiscountAllocationBase { /** * The title of the custom discount */ title: string; /** * The type of the custom discount */ type: 'custom'; } ``` ### CartDiscountCode * code The code for the discount ```ts string ``` ```ts export interface CartDiscountCode { /** * The code for the discount */ code: string; } ``` ## CheckoutApi The API object provided to `purchase.checkout` extension targets. * applyDiscountCodeChange (change: DiscountCodeChange) => Promise\ required Performs an update on the discount codes. It resolves when the new discount codes have been negotiated and results in an update to the value retrieved through the [`discountCodes`](https://shopify.dev/docs/api/checkout-ui-extensions/apis/discounts#standardapi-propertydetail-discountcodes) property. Caution \> See [security considerations](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#network-access) if your extension retrieves discount codes through a network call. Note This method will return an error if the [cart instruction](https://shopify.dev/docs/api/checkout-ui-extensions/apis/cart-instructions#standardapi-propertydetail-instructions) `discounts.canUpdateDiscountCodes` is false, or the buyer is using an accelerated checkout method, such as Apple Pay or Google Pay. ### DiscountCodeChange ```ts DiscountCodeAddChange | DiscountCodeRemoveChange ``` ### DiscountCodeAddChange * code The code for the discount (case-insensitive) ```ts string ``` * type The type of the \`DiscountCodeChange\` API. ```ts 'addDiscountCode' ``` ```ts export interface DiscountCodeAddChange { /** * The type of the `DiscountCodeChange` API. */ type: 'addDiscountCode'; /** * The code for the discount (case-insensitive) */ code: string; } ``` ### DiscountCodeRemoveChange * code The code for the discount (case-insensitive) ```ts string ``` * type The type of the \`DiscountCodeChange\` API. ```ts 'removeDiscountCode' ``` ```ts export interface DiscountCodeRemoveChange { /** * The type of the `DiscountCodeChange` API. */ type: 'removeDiscountCode'; /** * The code for the discount (case-insensitive) */ code: string; } ``` ### DiscountCodeChangeResult ```ts DiscountCodeChangeResultSuccess | DiscountCodeChangeResultError ``` ### DiscountCodeChangeResultSuccess * type Indicates that the discount code change was applied successfully. ```ts 'success' ``` ```ts export interface DiscountCodeChangeResultSuccess { /** * Indicates that the discount code change was applied successfully. */ type: 'success'; } ``` ### DiscountCodeChangeResultError * message A message that explains the error. This message is useful for debugging. It is \*\*not\*\* localized, and therefore should not be presented directly to the buyer. ```ts string ``` * type Indicates that the discount code change failed. ```ts 'error' ``` ```ts export interface DiscountCodeChangeResultError { /** * Indicates that the discount code change failed. */ type: 'error'; /** * A message that explains the error. This message is useful for debugging. * It is **not** localized, and therefore should not be presented directly * to the buyer. */ message: string; } ``` ## use​Apply​Discount​Code​Change() Returns a function to add or remove discount codes. ### Returns * (change: DiscountCodeChange) => Promise\ ### DiscountCodeChange ```ts DiscountCodeAddChange | DiscountCodeRemoveChange ``` ### DiscountCodeAddChange * code The code for the discount (case-insensitive) ```ts string ``` * type The type of the \`DiscountCodeChange\` API. ```ts 'addDiscountCode' ``` ```ts export interface DiscountCodeAddChange { /** * The type of the `DiscountCodeChange` API. */ type: 'addDiscountCode'; /** * The code for the discount (case-insensitive) */ code: string; } ``` ### DiscountCodeRemoveChange * code The code for the discount (case-insensitive) ```ts string ``` * type The type of the \`DiscountCodeChange\` API. ```ts 'removeDiscountCode' ``` ```ts export interface DiscountCodeRemoveChange { /** * The type of the `DiscountCodeChange` API. */ type: 'removeDiscountCode'; /** * The code for the discount (case-insensitive) */ code: string; } ``` ### DiscountCodeChangeResult ```ts DiscountCodeChangeResultSuccess | DiscountCodeChangeResultError ``` ### DiscountCodeChangeResultSuccess * type Indicates that the discount code change was applied successfully. ```ts 'success' ``` ```ts export interface DiscountCodeChangeResultSuccess { /** * Indicates that the discount code change was applied successfully. */ type: 'success'; } ``` ### DiscountCodeChangeResultError * message A message that explains the error. This message is useful for debugging. It is \*\*not\*\* localized, and therefore should not be presented directly to the buyer. ```ts string ``` * type Indicates that the discount code change failed. ```ts 'error' ``` ```ts export interface DiscountCodeChangeResultError { /** * Indicates that the discount code change failed. */ type: 'error'; /** * A message that explains the error. This message is useful for debugging. * It is **not** localized, and therefore should not be presented directly * to the buyer. */ message: string; } ``` ## use​Discount​Allocations() Returns the current discount allocations applied to the cart. ### Returns * CartDiscountAllocation\[] ### CartDiscountAllocation ```ts CartCodeDiscountAllocation | CartAutomaticDiscountAllocation | CartCustomDiscountAllocation ``` ### CartCodeDiscountAllocation * code The code for the discount ```ts string ``` * discountedAmount The money amount that has been discounted from the order ```ts Money ``` * type The type of the code discount ```ts 'code' ``` ```ts export interface CartCodeDiscountAllocation extends CartDiscountAllocationBase { /** * The code for the discount */ code: string; /** * The type of the code discount */ type: 'code'; } ``` ### Money * amount The price amount. ```ts number ``` * currencyCode The ISO 4217 format for the currency. ```ts CurrencyCode ``` ```ts export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } ``` ### CurrencyCode ```ts 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' ``` ### CartAutomaticDiscountAllocation * discountedAmount The money amount that has been discounted from the order ```ts Money ``` * title The title of the automatic discount ```ts string ``` * type The type of the automatic discount ```ts 'automatic' ``` ```ts export interface CartAutomaticDiscountAllocation extends CartDiscountAllocationBase { /** * The title of the automatic discount */ title: string; /** * The type of the automatic discount */ type: 'automatic'; } ``` ### CartCustomDiscountAllocation * discountedAmount The money amount that has been discounted from the order ```ts Money ``` * title The title of the custom discount ```ts string ``` * type The type of the custom discount ```ts 'custom' ``` ```ts export interface CartCustomDiscountAllocation extends CartDiscountAllocationBase { /** * The title of the custom discount */ title: string; /** * The type of the custom discount */ type: 'custom'; } ``` ## use​Discount​Codes() Returns the current discount codes applied to the cart. ### Returns * CartDiscountCode\[] ### CartDiscountCode * code The code for the discount ```ts string ``` ```ts export interface CartDiscountCode { /** * The code for the discount */ code: string; } ``` ## Related [![](https://shopify.dev/images/icons/32/blocks.png)![](https://shopify.dev/images/icons/32/blocks-dark.png)](https://shopify.dev/docs/api/checkout-ui-extensions/targets) [ReferenceTargets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) [![](https://shopify.dev/images/icons/32/apps.png)![](https://shopify.dev/images/icons/32/apps-dark.png)](https://shopify.dev/docs/api/checkout-ui-extensions/components) [ReferenceComponents](https://shopify.dev/docs/api/checkout-ui-extensions/components) [![](https://shopify.dev/images/icons/32/gear.png)![](https://shopify.dev/images/icons/32/gear-dark.png)](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) [ReferenceConfiguration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) [![](https://shopify.dev/images/icons/32/tutorial.png)![](https://shopify.dev/images/icons/32/tutorial-dark.png)](https://shopify.dev/apps/checkout) [LearnTutorials](https://shopify.dev/apps/checkout)