---
title: "discountCodeBasicUpdate"
description: "Updates a basic code discount."
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/mutations/discount-code-basic-update'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/mutations/discount-code-basic-update.md'
---
# discountCodeBasicUpdate

Updates a basic code discount.

- **Required Scopes:** `write_discounts`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Mutation

## Type Signature

`DiscountCodeBasicUpdatePayload`

## Required Permissions

* `write_discounts`

An access token is required to call this API. Refer to [Authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md) for more information about how to obtain the token.

## Arguments

* `basicCodeDiscount`

  [DiscountCodeBasicInput](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/inputs/discount-code-basic-input.md)

  The input data used to update the code discount

* `id`

  [ID](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/id.md)

  The ID of the code discount to update

## Returns

* `codeDiscountNode`

  [DiscountCodeNode](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-code-node.md)

  The underlying code discount object.

* `userErrors`

  [[DiscountUserError!]!](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-user-error.md)

  The list of errors that occurred from executing the mutation.

## Code Example

```graphql
mutation discountCodeBasicUpdate($basicCodeDiscount: DiscountCodeBasicInput $id: ID ) {
	discountCodeBasicUpdate(basicCodeDiscount: $basicCodeDiscount, id: $id ) 
		 {
			# DiscountCodeBasicUpdatePayload fields
		}
		
	}

```

## Variables

```json
{
  "basicCodeDiscount": {
    "appliesTimesPerCustomer": 0,
    "code": {},
    "combinesWith": {
      "orderDiscounts": {},
      "productDiscounts": false,
      "shippingDiscounts": false
    },
    "customerGets": {
      "items": {
        "all": false,
        "collections": {
          "add": "",
          "remove": ""
        },
        "products": {
          "productVariantsToAdd": "",
          "productVariantsToRemove": "",
          "productsToAdd": {},
          "productsToRemove": ""
        }
      },
      "value": {
        "discountAmount": {
          "amount": "{}",
          "appliesOnEachItem": false
        },
        "discountOnQuantity": {
          "effect": {
            "amount": "{}",
            "percentage": {}
          },
          "quantity": 0
        },
        "percentage": "{}"
      }
    },
    "customerSelection": {
      "all": false,
      "customerSegments": {
        "add": "",
        "remove": ""
      },
      "customers": {
        "add": "",
        "remove": ""
      }
    },
    "endsAt": "{}",
    "minimumRequirement": {
      "quantity": {
        "greaterThanOrEqualToQuantity": 0
      },
      "subtotal": {
        "greaterThanOrEqualToSubtotal": {}
      }
    },
    "startsAt": {},
    "title": "",
    "usageLimit": {}
  },
  "id": {}
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

