---
title: useApplyDiscountCodeChange
description: >-
Returns a function to add or remove discount codes.
> Caution:
> See [security
considerations](/docs/api/checkout-ui-extensions/configuration#network-access)
if your extension retrieves discount codes through a network call.
api_version: 2023-07
api_name: checkout-ui-extensions
source_url:
html: >-
https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/reductions/useapplydiscountcodechange
md: >-
https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/reductions/useapplydiscountcodechange.md
---
# useApplyDiscountCodeChange
Returns a function to add or remove discount codes.
**Caution:** See \security considerations\ if your extension retrieves discount codes through a network call.
## useApplyDiscountCodeChange()
### Returns
* **(change: DiscountCodeChange) => Promise\**
### DiscountCodeChange
```ts
DiscountCodeAddChange | DiscountCodeRemoveChange
```
### DiscountCodeAddChange
* type
The type of the \`DiscountCodeChange\` API.
```ts
"addDiscountCode"
```
* code
The code for the discount
```ts
string
```
### DiscountCodeRemoveChange
* type
The type of the \`DiscountCodeChange\` API.
```ts
"removeDiscountCode"
```
* code
The code for the discount
```ts
string
```
### DiscountCodeChangeResult
```ts
DiscountCodeChangeResultSuccess | DiscountCodeChangeResultError
```
### DiscountCodeChangeResultSuccess
* type
Indicates that the discount code change was applied successfully.
```ts
"success"
```
### DiscountCodeChangeResultError
* type
Indicates that the discount code change failed.
```ts
"error"
```
* 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
```
## Related
[APIs - StandardApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/standardapi)
[APIs - CheckoutApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/checkoutapi)
[APIs - OrderStatusApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/orderstatusapi)
[APIs - CartLineItemApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/cartlineitemapi)
[APIs - PickupPointListApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuppointlistapi)
[APIs - PickupLocationListApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuplocationlistapi)
[APIs - ShippingOptionItemApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/shippingoptionitemapi)
[APIs - ExtensionTargets](https://shopify.dev/docs/api/checkout-ui-extensions/apis/extensiontargets)