Remove discount minimum requirement

Hello,
I’m having troubles updating a DiscountCodeBasic, specifically, removing a minimum requirement.
The documentation says that this discount type shouldn’t be zero, but sending null isn’t working, the update process does nothing.
I’m using the 2024-10 API version in express.js with typescript.

Until now I’ve tried with different values, even with wrong values such as empty string and zero, but no luck. These are my attempts:

  • send null in minimum requirement
  • send zero (obviously fails)
  • Change it to a different type of minimum requirement
  • Omitting the minimum requirement value (set the object property as undefined removes the key:value from the object)
  • Send an empty string ''. This returns that is not a decimal.

Is this feature available?
Deleting and creating the discount again is not a good solution because it would remove the discount usage tracking and other business requirements.

Thanks in advance!!

I’m using this doc reference

This is the payload example.

    {
      "action": "update-coupon",
      "data": {
        "id": "gid://shopify/DiscountCodeNode/1496960663841",
        "basicCodeDiscount": {
          "startsAt": "2023-12-19T00:00:00.000Z",
          "endsAt": "2026-01-01T00:00:00.000Z",
          "customerGets": {
            "value": {
              "discountAmount": {
                "amount": 5000,
                "appliesOnEachItem": false
              }
            },
            "items": {
              "all": true
            }
          },
          "minimumRequirement": null
        }
      }
    }

Note:
minimum requirement says null, but I’ve built the payload using the corresponding structure according the documentation.

        "minimumRequirement": {
          "subtotal": {
            "greaterThanOrEqualToSubtotal": {
              "amount": ""
            }
          }
        }

The graphql query:

export const getDiscountsQuery = `#graphql
query GetDiscounts($query: String = "", $first: Int = 10, $first1: Int = 10, $after: String = "") {
  discountNodes(first: $first, query: $query, after: $after) {
    edges {
      cursor
      node {
        id
        discount {
          ... on DiscountCodeBasic {
            endsAt
            startsAt
            status
            title
            minimumRequirement {
              ... on DiscountMinimumSubtotal {
                __typename
                greaterThanOrEqualToSubtotal {
                  amount
                  currencyCode
                }
              }
            }
            customerGets {
              value {
                ... on DiscountAmount {
                  __typename
                  amount {
                    amount
                  }
                }
                ... on DiscountPercentage {
                  __typename
                  percentage
                }
              }
              items {
                ... on AllDiscountItems {
                  __typename
                  allItems
                }
                ... on DiscountProducts {
                  __typename
                  productVariants(first: $first1) {
                    pageInfo {
                      startCursor
                      hasPreviousPage
                      hasNextPage
                      endCursor
                    }
                    nodes {
                      sku
                      id
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    pageInfo {
      endCursor
      hasNextPage
      hasPreviousPage
      startCursor
    }
  }
}
`;

Hi Aldochaconc,

To update a DiscountCodeBasic and remove the minimumRequirement , you should set the minimumRequirement field to null, but it sounds like this is not working for you. Can you add userErrors to your query to see if there’s any additional info returned on why this is failing?