cart
- Query
- Storefront
Returns a cart by its id, including its lines, costs, buyer and delivery details, or null when the cart cannot be found.
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
id | ID! | Required |
Returns
Cart A buyer's cart: its lines, costs, buyer identity, delivery details, discount and gift card codes, attributes and note, and the checkoutUrl to pay for it.
| Field | Type | Description |
|---|---|---|
appliedGiftCards | [AppliedGiftCard!]! | |
attribute | Attribute |
|
attributes | [Attribute!]! | |
buyerIdentity | CartBuyerIdentity! | |
checkoutUrl | URL! | |
cost | CartCost! | |
createdAt | DateTime! | |
delivery | CartDelivery! | |
deliveryGroups | CartDeliveryGroupConnection! | |
discountAllocations | [CartDiscountAllocation!]! | Deprecated |
discountApplications | [BaseCartDiscountApplication!]! | |
discountCodes | [CartDiscountCode!]! | |
estimatedCost | CartEstimatedCost! | Deprecated |
id | ID! | |
lines | BaseCartLineConnection! | |
metafield | Metafield | |
metafields | [Metafield]! |
|
note | String | |
totalQuantity | Int! | |
updatedAt | DateTime! | |
tanqoryExtTip | MoneyV2 | The buyer's tip set with tanqoryExtCartTipUpdate, in the cart's currency; null when there is none. Needs the cart's key (null without it). Private token only. |
tanqoryExtDutiesEstimate | TanqoryExtDutiesEstimate | The duties and import taxes of the cart's destination, in the cart's currency; null when none applies (a domestic or intra-EU order, duties not turned on for the destination's market, no goods that ship, a value within the de minimis, or no figure from the merchant's rates or the provider yet). |
tanqoryExtDutiesTerms | TanqoryExtDutiesIncoterm | The terms the order is sold on when its destination's market is in "Collect in" (duties turned on, a destination across a customs border): DDP when checkout charges the duties and import taxes or the prices include them; DAP when the buyer may pay them on delivery (a DAP market, or a DDP market for which no amount could be calculated: that order is sold DAP). Null otherwise. Needs the cart's key (null without it). Private token only. |
tanqoryExtTax | TanqoryExtCartTax | The checkout's tax for the selected delivery address, as the order will book it; null before an address is selected. Needs the cart's key (null without it). Private token only. |
tanqoryExtAppliedStoreCredit | TanqoryExtAppliedStoreCredit | What the checkout takes from the signed-in buyer's store credit now (after the gift cards, at most the amount asked for with tanqoryExtCheckoutStoreCreditApply, the balance and what is left to pay); null when none applies. Already deducted from cost.checkoutChargeAmount. Private token only. |
Example request
A starting point: required arguments as variables and a few fields of the result. Replace the placeholders.
Set STORE_ID and TANQORY_STOREFRONT_TOKEN in your environment first (Make your first API call).
curl -X POST "https://$STORE_HOST/api/v1/stores/$STORE_ID/2026-10/graphql" \
-H "X-Tanqory-Storefront-Access-Token: $TANQORY_STOREFRONT_TOKEN" \
-H "Content-Type: application/json" \
--data '{"query":"query Cart($id: ID!) {\n cart(id: $id) {\n appliedGiftCards { id }\n checkoutUrl\n createdAt\n id\n note\n totalQuantity\n updatedAt\n tanqoryExtTip {\n amount\n currencyCode\n }\n tanqoryExtDutiesTerms\n }\n}","variables":{"id":"gid://tanqory/Type/id"}}'// Node.js 18 or later (fetch is built in). Save as request.mjs and run: node request.mjs
const query = `query Cart(\$id: ID!) {
cart(id: \$id) {
appliedGiftCards { id }
checkoutUrl
createdAt
id
note
totalQuantity
updatedAt
tanqoryExtTip {
amount
currencyCode
}
tanqoryExtDutiesTerms
}
}`;
const variables = {
"id": "gid://tanqory/Type/id"
};
const res = await fetch(`https://${process.env.STORE_HOST}/api/v1/stores/${process.env.STORE_ID}/2026-10/graphql`, {
method: 'POST',
headers: {
'X-Tanqory-Storefront-Access-Token': process.env.TANQORY_STOREFRONT_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, variables }),
});
console.log(res.status, JSON.stringify(await res.json(), null, 2));# Python 3, standard library only. Save as request.py and run: python3 request.py
import json, os, urllib.request
query = """query Cart($id: ID!) {
cart(id: $id) {
appliedGiftCards { id }
checkoutUrl
createdAt
id
note
totalQuantity
updatedAt
tanqoryExtTip {
amount
currencyCode
}
tanqoryExtDutiesTerms
}
}"""
variables = json.loads("""{
"id": "gid://tanqory/Type/id"
}""")
req = urllib.request.Request(
"https://" + os.environ["STORE_HOST"] + "/api/v1/stores/" + os.environ["STORE_ID"] + "/2026-10/graphql",
data=json.dumps({"query": query, "variables": variables}).encode(),
headers={
"X-Tanqory-Storefront-Access-Token": os.environ["TANQORY_STOREFRONT_TOKEN"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.status, json.dumps(json.load(res), indent=2))