Hey, we are using the shopify storefront api’s to manage customer’s shopping, And there is a critical issue for the cost when automatic discount is applied.
query cart($cart_id: ID!, $first: Int) @inContext(language: EN, country: HK) {
cart(id: $cart_id) {
totalQuantity
checkoutUrl
discountCodes {
applicable
code
}
discountAllocations {
... on CartAutomaticDiscountAllocation {
title
discountedAmount {
amount
currencyCode
}
}
}
cost {
totalAmount {
amount
currencyCode
}
subtotalAmount {
amount
currencyCode
}
totalTaxAmount {
amount
currencyCode
}
totalDutyAmount {
amount
currencyCode
}
}
lines(first: $first) {
edges {
node {
id
quantity
cost {
totalAmount {
amount
currencyCode
}
subtotalAmount {
amount
currencyCode
}
}
discountAllocations {
... on CartAutomaticDiscountAllocation {
title
discountedAmount {
amount
currencyCode
}
}
}
merchandise {
... on ProductVariant {
id
product {
id
title
featuredImage {
url
}
priceRange {
maxVariantPrice {
amount
currencyCode
}
minVariantPrice {
amount
currencyCode
}
}
}
}
}
}
}
}
}
}
in the response, the lines returned here is not correct, the totalAmount and ‘subtotalAmount’ should be $169*2=$338.
We have an active automatic discount in our shopify store, and the issue only happens when this rule is applied to the cart.
But in the checkout link , everything is correct:


