Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
i use storefrontApi query cart ,
when ProductVariant price change ,the cart cartcost do not change ,
andCartLine.merchandise price has change
i use CartCost.subtotalAmount and CartCost.totalAmount to show customer
this is one request
{"variables":{"cartId":"gid://shopify/Cart/c1-a730771f9d91accaaef512fe5c91e061"},"query":"query getCart($cartId: ID!) { cart(id: $cartId) { ...cartDetails }}fragment cartDetails on Cart { id totalQuantity checkoutUrl cost { subtotalAmount { amount } totalAmount { amount } } lines(first: 99) { edges { node { quantity id merchandise { ... on ProductVariant { compareAtPrice { amount } selectedOptions { name value } id sku title availableForSale quantityAvailable image { url } price { amount } } } } } }}"}
this is response
{"data":{"cart":{"totalQuantity":3,"cost":{"totalAmount":{"amount":"139.5"},"subtotalAmount":{"amount":"155.0"}},"id":"gid://shopify/Cart/c1-a730771f9d91accaaef512fe5c91e061","lines":{"edges":[{"node":{"merchandise":{"availableForSale":true,"image":{"url":"https://cdn.shopify.com/s/files/1/0565/5416/0185/products/c04e3cea-8a3e-4a13-9c0b-57e53656b249.png?v..."},"quantityAvailable":8,"price":{"amount":"100.0"},"selectedOptions":[{"name":"***or","value":"Army Green"},{"name":"**ze","value":"L"}],"id":"gid://shopify/ProductVariant/41154795929657","sku":"I1fsjt2fup2k","title":"Army Green / L"},"quantity":1,"id":"gid://shopify/CartLine/9441cbfe-e0f6-46f1-b0e1-74acdb0cd241?cart=c1-a730771f9d91accaaef512fe5c91e061"}},{"node":{"merchandise":{"availableForSale":true,"image":{"url":"https://cdn.shopify.com/s/files/1/0565/5416/0185/products/1547695959928981774.jpg?v=1677034093"},"quantityAvailable":4,"price":{"amount":"55.0"},"selectedOptions":[{"name":"***or","value":"Multicolor"}],"id":"gid://shopify/ProductVariant/41135248834617","sku":"I1glz37uu2an","title":"Multicolor"},"quantity":1,"id":"gid://shopify/CartLine/13b54303-656f-40a2-83e1-aeef67dd8ade?cart=c1-a730771f9d91accaaef512fe5c91e061"}},{"node":{"merchandise":{"availableForSale":true,"image":{"url":"https://cdn.shopify.com/s/files/1/0565/5416/0185/products/15295749682661757536.jpg?v=1677055983"},"quantityAvailable":998,"price":{"amount":"79.0"},"selectedOptions":[{"name":"***or","value":"Multicolor"},{"name":"**ze","value":"L"}],"id":"gid://shopify/ProductVariant/41150540742713","sku":"I1fsjt35toji","title":"Multicolor / L","compareAtPrice":{"amount":"109.0"}},"quantity":1,"id":"gid://shopify/CartLine/160bbc4b-b3b0-43b4-aa7e-27e72da29adf?cart=c1-a730771f9d91accaaef512fe5c91e061"}}]},"checkoutUrl":"https://shein-test2.myshopify.com/cart/c/c1-a730771f9d91accaaef512fe5c91e061"}}}