All things Shopify and commerce
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
@user_spritle wrote: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}}}}}
To create an automatic discount for a specific amount off products in Shopify using GraphQL, you can follow these steps:
Set Up Your Shopify Store: Ensure you have access to the Shopify Admin API and have the necessary permissions to create discounts.
Use the GraphQL Admin API: You'll want to interact with the API to create a discount. Specifically, you'll use the discountCodeCreate mutation.
Construct Your Mutation: Here’s a basic example of how to structure your mutation for an amount-off discount.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024