# DiscountCodeNode - admin-graphql - OBJECT Version: 2024-10 ## 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-graphql/2024-10/unions/DiscountCode): DiscountCode! - The underlying code discount object. * [id](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - A globally-unique ID. * [metafield](/docs/api/admin-graphql/2024-10/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. * [privateMetafield](/docs/api/admin-graphql/2024-10/objects/PrivateMetafield): PrivateMetafield - Returns a private metafield by namespace and key that belongs to the resource. ## Connections * [events](/docs/api/admin-graphql/2024-10/connections/EventConnection): EventConnection! * [metafieldDefinitions](/docs/api/admin-graphql/2024-10/connections/MetafieldDefinitionConnection): MetafieldDefinitionConnection! * [metafields](/docs/api/admin-graphql/2024-10/connections/MetafieldConnection): MetafieldConnection! * [privateMetafields](/docs/api/admin-graphql/2024-10/connections/PrivateMetafieldConnection): PrivateMetafieldConnection! ## Related queries * [codeDiscountNode](/docs/api/admin-graphql/2024-10/queries/codeDiscountNode) Returns a [code discount](https://help.shopify.com/manual/discounts/discount-types#discount-codes) resource by ID. * [codeDiscountNodeByCode](/docs/api/admin-graphql/2024-10/queries/codeDiscountNodeByCode) Returns a code discount identified by its discount code. * [codeDiscountNodes](/docs/api/admin-graphql/2024-10/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-graphql/2024-10/mutations/discountCodeActivate) Activates a code discount. * [discountCodeBasicCreate](/docs/api/admin-graphql/2024-10/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-graphql/2024-10/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-graphql/2024-10/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-graphql/2024-10/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-graphql/2024-10/mutations/discountCodeDeactivate) Deactivates a code discount. * [discountCodeFreeShippingCreate](/docs/api/admin-graphql/2024-10/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-graphql/2024-10/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-graphql/2024-10/unions/MetafieldReferencer) Types of resources that may use metafields to reference other resources. ## Examples