Looking at the docs, one could think that the discount on a fresh subscription draft of a contract that was checked out using a subscription-only code discount would contain a SubscriptionAppliedCodeDiscount discount. To my surprise, that is not true.
Querying a fresh subscription draft:
{
"subscriptionDraft": {
"id": "gid://shopify/SubscriptionDraft/5364745699708",
"status": "ACTIVE",
"discounts": {
"nodes": [
{
"__typename": "SubscriptionManualDiscount",
"id": "gid://shopify/SubscriptionManualDiscount/7a9241fa-b74d-4616-a932-d36d5e814b88",
"type": "CODE_DISCOUNT",
"title": "SPECIALDISCOUNT",
"targetType": "LINE_ITEM",
"value": {
"percentage": 17
},
"entitledLines": {
"all": false,
"lines": {
"edges": [
{
"node": {
"id": "gid://shopify/SubscriptionLine/bc505946-5393-48ca-a64f-774780c2c829",
"title": "new product 1",
"variantTitle": "Gold"
}
}
]
}
}
}
]
}
}
Steps to reproduce
- Create a discount in Shopify that applies to subscription products and all billing cycles
- Add a product with a selling plan to the cart, then apply the discount code. Proceed with checkout
- Create a subscription draft for the contract
- Fetch the draft, especially the discounts and check for the
__typename
Questions
- If not in this example, when would a subscription draft contain a
SubscriptionAppliedCodeDiscountdiscount? - Why is the discount spread on each line item explicitly (see
entitledLines), instead of using theallboolean?
