Get Cart
GetCart Query
This query retrieves the current cart details by cart ID. It is typically used after cart mutations to render cart summaries, mini-carts, or to prepare for checkout redirection.
Note: In customer flows, the cart is associated with a
sessionidheader. You usually resolve the current cart via session on the backend and passcart.idto your frontend to use in this query.
Input Parameters​
$storeId: ID!– The store in which the cart lives.$id: ID– Cart identifier (Cart_...). If omitted, the backend may fall back to the active cart resolved from the current session (implementation-specific).
Response Structure​
Returns a Cart object with:
id– Cart ID to be used in checkout URLs.refCode– Optional referral or tracking code associated with the cart.recoveryId– Identifier used for cart recovery flows.sessionId– Associated session identifier.status/cartStep/lastStep– Current and last completed cart lifecycle steps.items– Line items (for simple items):idquantityprice/totalPrice(Money)variant(basic product information)
receipt– Monetary breakdown:subtotal,discount,shipping,tax,automaticDiscount,total.
shippingDetails– Saved shipping address and area info (country/state/city/region IDs).shippingRate– Selected shipping rate cost (Money).contactInfo– Basic contact information (name, email, phone).customer– Linked customer (id, name, email, phone).promoCode– Applied promo code information (id, code, type).shippingDiscount– Shipping discount metadata (id, title).cartErrors– Cart-level errors (code + params such as message, resourceId, requested/available quantity).paymentIntentId/paymentIntent– Payment intent identifiers and status.isReserved/reservedAt– Reservation status and timestamp.emailStatus/emailSentAt– Email sending state for the cart.createdAt/updatedAt– Cart creation and last update timestamps.
Example Variables​
{
"storeId": "Store_cm84j35iy02m001i89iiu2cts",
"id": "Cart_d8f8ce2f-681e-4554-93b7-230e0b34a151"
}
Implementation Notes​
- Call
GetCartafterAddToCartorReplaceCartItemsto get the latest totals. - Use the returned
cart.idto construct checkout URLs on your landing pages. - You can cache the cart client-side, but always re-fetch before checkout to avoid stale totals.
GraphQL Endpoint​
https://graphql.wuilt.com
Operation: GetCart​
Try It Out​
Query​
Query Variables
1
2
3
4
Note: Make sure to change the storeId with your store ID. For guidance on how to get your store ID, reference the Store ID guide.
Authentication​
To use this query, you will need an API key. Click the "API Key" button in the navigation bar to enter your credentials.