The graphQL (Shopify Functions - Product API) does not seem to return the Discounts or Codes already applied in the Cart (ie. Automatic Discount)
Graphql:
query Input($tags: [String!]!) {
cart {
cost {
subtotalAmount {
amount
}
totalAmount {
amount
}
}
lines {
quantity
cost {
amountPerQuantity {
amount
}
compareAtAmountPerQuantity {
amount
}
subtotalAmount {
amount
}
totalAmount {
amount
}
}
merchandise {
__typename
... on ProductVariant {
id
product {
doTagsMatch: hasAnyTag(tags: $tags)
id
}
}
}
}
}
discountNode {
metafield(namespace: "$app:discount-price", key: "function-configuration") {
value
}
}
}
Shopify input Log. The Functions does not seem to see 30% discount with the code EXTRA is already applied in the cart/checkout
{
"cart": {
"cost": {
"subtotalAmount": {
"amount": "300.0"
},
"totalAmount": {
"amount": "300.0"
}
},
"lines": [
{
"quantity": 1,
"cost": {
"amountPerQuantity": {
"amount": "100.0"
},
"compareAtAmountPerQuantity": null,
"subtotalAmount": {
"amount": "100.0"
},
"totalAmount": {
"amount": "100.0"
}
},
"merchandise": {
"__typename": "ProductVariant",
"id": "gid://shopify/ProductVariant/44281460818228",
"product": {
"doTagsMatch": false,
"id": "gid://shopify/Product/8085131100468"
}
}
},
{
"quantity": 1,
"cost": {
"amountPerQuantity": {
"amount": "100.0"
},
"compareAtAmountPerQuantity": null,
"subtotalAmount": {
"amount": "100.0"
},
"totalAmount": {
"amount": "100.0"
}
},
"merchandise": {
"__typename": "ProductVariant",
"id": "gid://shopify/ProductVariant/45604449288500",
"product": {
"doTagsMatch": true,
"id": "gid://shopify/Product/8396169052468"
}
}
},
{
"quantity": 1,
"cost": {
"amountPerQuantity": {
"amount": "100.0"
},
"compareAtAmountPerQuantity": null,
"subtotalAmount": {
"amount": "100.0"
},
"totalAmount": {
"amount": "100.0"
}
},
"merchandise": {
"__typename": "ProductVariant",
"id": "gid://shopify/ProductVariant/45604736958772",
"product": {
"doTagsMatch": true,
"id": "gid://shopify/Product/8396223971636"
}
}
}
]
},
"discountNode": {
"metafield": {
"value": "{\"targetingStrategy\":\"tag\",\"tags\":[\"Sale\"],\"message\":\"10% Extra\",\"percentage\":10}"
}
}
}