A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
"discount_applications": {
"discount_applications": [
{
"type": "manual",
"title": "custom discount",
"value": "2.0",
"value_type": "fixed_amount",
"description": "customer deserved it",
"target_type": "line_item",
"target_selection": "explicit",
"allocation_method": "across"
},
{
"type": "script",
"value": "5.0",
"value_type": "fixed_amount",
"description": "my scripted discount",
"target_type": "shipping_line",
"target_selection": "explicit",
"allocation_method": "across"
},
{
"code": "SUMMERSALE",
"type": "discount_code",
"value": "10.0",
"value_type": "fixed_amount",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across"
}
]
},
"discount_codes": [
{
"code": "SPRING30",
"type": "fixed_amount",
"amount": "30.00"
}
],
This code is part of an order object in link https://shopify.dev/api/admin-rest/2021-10/resources/order#resource_object
I have some questions about this:
1. Can I have more than one discount_application on one order? The filed discount_applications is an array.
2. There are 3 types, manual and script and discount_code. How do I generate these discounts? When a customer input a code in checkout page, which discount will generate?
3. What is the difference between discount_applications and discount_codes?
Solved! Go to the solution
This is an accepted solution.
One update in my first answer:
There can be 4 types within the discount_application type:
And now to answer your follow up questions:
Your mean is there could be 3 discount_application in one order at most. But the types must be different just like as below, right?
=> There could be 4 tyes but Yes, you shouldn't see the same type again in the discount_application field
If there is a discount_code type in discount_application, and there must be a “discount_codes” object in the order?
=> Yes
Hello Lewen,
Please find the answers (based on my understanding and experience) as below:
1. Can I have more than one discount_application on one order? The filed discount_applications is an array.
=> You can have more than one type (manual, discount_code, and script) in the discount_application field but discount_application will be present only once on the order level
2. There are 3 types, manual and script, and discount_code. How do I generate these discounts? When a customer input a code on the checkout page, which discount will generate?
=> discount_code - when a customer applies a discount while placing an order, the other 2 can be generated via creating a draft order from Shopify admin and admin scripts in Shopify plus store
3. What is the difference between discount_applications and discount_codes?
=> Discount application tells you which discounts are applied on that orders and discount code will give you info on which discount codes are applied on that order
1. Can I have more than one discount_application on one order? The filed discount_applications is an array.
=> You can have more than one type (manual, discount_code, and script) in the discount_application field but discount_application will be present only once on the order level
=> Your mean is there could be 3 discount_application in one order at most. But the types must be different just like as below, right?
"discount_applications": {
"discount_applications": [
{
"type": "manual",
"title": "custom discount",
"value": "2.0",
"value_type": "fixed_amount",
"description": "customer deserved it",
"target_type": "line_item",
"target_selection": "explicit",
"allocation_method": "across"
},
{
"type": "script",
"value": "5.0",
"value_type": "fixed_amount",
"description": "my scripted discount",
"target_type": "shipping_line",
"target_selection": "explicit",
"allocation_method": "across"
},
{
"code": "SUMMERSALE",
"type": "discount_code",
"value": "10.0",
"value_type": "fixed_amount",
"target_type": "line_item",
"target_selection": "all",
"allocation_method": "across"
}
]
},
3. What is the difference between discount_applications and discount_codes?
=> Discount application tells you which discounts are applied on that orders and discount code will give you info on which discount codes are applied on that order
=> If there is a discount_code type in discount_application, and there must be a “discount_codes” object in the order?
This is an accepted solution.
One update in my first answer:
There can be 4 types within the discount_application type:
And now to answer your follow up questions:
Your mean is there could be 3 discount_application in one order at most. But the types must be different just like as below, right?
=> There could be 4 tyes but Yes, you shouldn't see the same type again in the discount_application field
If there is a discount_code type in discount_application, and there must be a “discount_codes” object in the order?
=> Yes
Thank you.