# DiscountCodeNode - admin - OBJECT
Version: 2025-01

## Description
The `DiscountCodeNode` object enables you to manage [code discounts](https://help.shopify.com/manual/discounts/discount-types#discount-codes) that are applied when customers enter a code at checkout. For example, you can offer discounts where customers have to enter a code to redeem an amount off discount on products, variants, or collections in a store. Or, you can offer discounts where customers have to enter a code to get free shipping. Merchants can create and share discount codes individually with customers.

Learn more about working with [Shopify's discount model](https://shopify.dev/docs/apps/build/discounts),
including related queries, mutations, limitations, and considerations.

### Access Scopes
Apps must have `read_discounts` access scope.


## Fields
* [codeDiscount](/docs/api/admin/2025-01/unions/DiscountCode): DiscountCode! - The underlying code discount object.
* [id](/docs/api/admin/2025-01/scalars/ID): ID! - A globally-unique ID.
* [metafield](/docs/api/admin/2025-01/objects/Metafield): Metafield - A [custom field](https://shopify.dev/docs/apps/build/custom-data),
including its `namespace` and `key`, that's associated with a Shopify resource
for the purposes of adding and storing additional information.

## Connections
* [events](/docs/api/admin/2025-01/connections/EventConnection): EventConnection!
* [metafieldDefinitions](/docs/api/admin/2025-01/connections/MetafieldDefinitionConnection): MetafieldDefinitionConnection!
* [metafields](/docs/api/admin/2025-01/connections/MetafieldConnection): MetafieldConnection!



## Related queries
* [codeDiscountNode](/docs/api/admin/2025-01/queries/codeDiscountNode) Returns a [code discount](https://help.shopify.com/manual/discounts/discount-types#discount-codes) resource by ID.
* [codeDiscountNodeByCode](/docs/api/admin/2025-01/queries/codeDiscountNodeByCode) Returns a code discount identified by its discount code.
* [codeDiscountNodes](/docs/api/admin/2025-01/queries/codeDiscountNodes) Returns a list of [code-based discounts](https://help.shopify.com/manual/discounts/discount-types#discount-codes).

## Related mutations
* [discountCodeActivate](/docs/api/admin/2025-01/mutations/discountCodeActivate) Activates a code discount.
* [discountCodeBasicCreate](/docs/api/admin/2025-01/mutations/discountCodeBasicCreate) Creates an [amount off discount](https://help.shopify.com/manual/discounts/discount-types/percentage-fixed-amount) that's applied on a cart and at checkout when a customer enters a code. Amount off discounts can be a percentage off or a fixed amount off.

> Note:
> To create discounts that are automatically applied on a cart and at checkout, use the [`discountAutomaticBasicCreate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/discountAutomaticBasicCreate) mutation.
* [discountCodeBasicUpdate](/docs/api/admin/2025-01/mutations/discountCodeBasicUpdate) Updates an [amount off discount](https://help.shopify.com/manual/discounts/discount-types/percentage-fixed-amount) that's applied on a cart and at checkout when a customer enters a code. Amount off discounts can be a percentage off or a fixed amount off.

> Note:
> To update discounts that are automatically applied on a cart and at checkout, use the [`discountAutomaticBasicUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/discountAutomaticBasicUpdate) mutation.
* [discountCodeBxgyCreate](/docs/api/admin/2025-01/mutations/discountCodeBxgyCreate) Creates a
[buy X get Y discount (BXGY)](https://help.shopify.com/manual/discounts/discount-types/buy-x-get-y)
that's applied on a cart and at checkout when a customer enters a code.

> Note:
> To create discounts that are automatically applied on a cart and at checkout, use the
[`discountAutomaticBxgyCreate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/discountAutomaticBxgyCreate)
mutation.
* [discountCodeBxgyUpdate](/docs/api/admin/2025-01/mutations/discountCodeBxgyUpdate) Updates a
[buy X get Y discount (BXGY)](https://help.shopify.com/manual/discounts/discount-types/buy-x-get-y)
that's applied on a cart and at checkout when a customer enters a code.

> Note:
> To update discounts that are automatically applied on a cart and at checkout, use the
[`discountAutomaticBxgyUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/discountAutomaticBxgyUpdate)
mutation.
* [discountCodeDeactivate](/docs/api/admin/2025-01/mutations/discountCodeDeactivate) Deactivates a code discount.
* [discountCodeFreeShippingCreate](/docs/api/admin/2025-01/mutations/discountCodeFreeShippingCreate) Creates an [free shipping discount](https://help.shopify.com/manual/discounts/discount-types/free-shipping) that's applied on a cart and at checkout when a customer enters a code.

> Note:
> To create discounts that are automatically applied on a cart and at checkout, use the [`discountAutomaticFreeShippingCreate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/discountAutomaticFreeShippingCreate) mutation.
* [discountCodeFreeShippingUpdate](/docs/api/admin/2025-01/mutations/discountCodeFreeShippingUpdate) Updates a [free shipping discount](https://help.shopify.com/manual/discounts/discount-types/free-shipping) that's applied on a cart and at checkout when a customer enters a code.

> Note:
> To update a free shipping discount that's automatically applied on a cart and at checkout, use the [`discountAutomaticFreeShippingUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/discountAutomaticFreeShippingUpdate) mutation.

## Related Unions
* [MetafieldReferencer](/docs/api/admin/2025-01/unions/MetafieldReferencer) Types of resources that may use metafields to reference other resources.

## Examples