We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How to create automatic discount for amount off products in shopify using Graphql

How to create automatic discount for amount off products in shopify using Graphql

user_spritle
Shopify Partner
1 0 1

There is a option to create a automatic discount using API on shopify for amount off order. I want to create a automatic discount for amount off product using graphql

I tried to alter this JSON to apply the discount for products, but it didn't work. is there any possibility to achieve this? https://shopify.dev/docs/api/admin-graphql/2024-07/mutations/discountAutomaticBasicCreate

 


{
  "query": "mutation discountAutomaticBasicCreate($automaticBasicDiscount: DiscountAutomaticBasicInput!) { discountAutomaticBasicCreate(automaticBasicDiscount: $automaticBasicDiscount) { automaticDiscountNode { id automaticDiscount { ... on DiscountAutomaticBasic { startsAt endsAt minimumRequirement { ... on DiscountMinimumSubtotal { greaterThanOrEqualToSubtotal { amount currencyCode } } } customerGets { value { ... on DiscountAmount { amount { amount currencyCode } appliesOnEachItem } } items { ... on AllDiscountItems { allItems } } } } } } userErrors { field code message } } }",
  "variables": {
    "automaticBasicDiscount": {
      "title": "$100 off all orders over $500 for all customers",
      "startsAt": "2024-01-01T00:00:00Z",
      "endsAt": "2024-12-31T23:59:59Z",
      "minimumRequirement": {
        "subtotal": {
          "greaterThanOrEqualToSubtotal": 500
        }
      },
      "customerGets": {
        "value": {
          "discountAmount": {
            "amount": 100,
            "appliesOnEachItem": false
          }
        },
        "items": {
          "all": true
        }
      }
    }
  }
}
Reply 1 (1)

OSF-SC
Visitor
1 0 0

I have exactly the same problem.

Is there a solution?
thanks!