GraphQL Shopping Cart API

The only shopping cart API designed to work with your existing frontend or backend.

  • No replatforming required
  • Use your existing inventory
  • Simple cart management API

Bring your own frontend, or backend

However you handle carts, on the frontend or as a separate microservice, CartQL was designed to fit right in.

Works with static sites

No longer worry about maintaining a server to handle carts. Works with Apollo Client, URQL and more.

No replatforming

CartQL was built to handle custom cart items for skus, promotions, shipping and so much more.

Secure

Securely persist and manage carts for your users, all without authentication.

Flexible cart items

Store any type of data on cart and cart items with the CartQL mutations API.

Metadata

CartQL takes care of calculating the cart, line and unit item totals, whatever the currency.

Microservice

CartQL can be used directly with your static site or stitched together with your other APIs.

What you see is what you get

Add, update and remove cart items with a simple declarative GraphQL API

1

Create a Cart

Quickly create or retrive existing carts by ID

query {
cart(id: ID!) {
...CartWithItems
}
}
fragment CartWithItems on Cart {
...CartInfo
items {
...ItemInfo
}
}
fragment CartInfo on Cart {
id
isEmpty
abandoned
totalItems
totalUniqueItems
currency {
code
symbol
}
subTotal {
amount
formatted
}
attributes {
key
value
}
}
fragment ItemInfo on CartItem {
id
name
description
image
sku
quantity
attributes {
key
value
}
unitTotal {
amount
formatted
}
lineTotal {
amount
formatted
}
}
2

Add to Cart

Add any item to the cart, with all the data you need

mutation {
addItem(
input: {
cartId: ID!
id: ID!
name: String
description: String
image: String
price: Int!
quantity: Int
attributes: [
{
key: String!,
value: String
}
]
}
) {
...CartWithItems
}
}
3

Update cart item

Easily update or override item fields at any time

mutation {
updateItem(
input: {
cartId: ID!
id: ID!
quantity: Int
}
) {
...CartWithItems
}
}
4

Remove cart item

No longer need an item? No problem!

mutation {
removeItem(
input: {
cartId: ID!
id: ID!
}
) {
...CartWithItems
}
}

Top-notch DX

We've made it even easier to perform regular cart tasks

Increment cart item quantity

mutation {
incrementItemQuantity(
input: { cartId: ID!, id: ID!, by: Int! }
) {
...CartWithItems
}
}

Decrement cart item quantity

mutation {
decrementItemQuantity(
input: { cartId: ID!, id: ID!, by: Int! }
) {
...CartWithItems
}
}

Empty cart

mutation {
emptyCart(
input: { id: ID! }
) {
...CartWithItems
}
}

Set all cart items

mutation {
setItems(
input: { cartId: ID!, items: SetCartItemInput! }
) {
...CartWithItems
}
}

Update the cart with custom data

mutation {
updateCart(
input: {
id: ID!,
attributes: [
{
key: String!,
value: String
}
]
}
) {
...CartInfo
}
}

Easily set cart and cart item money formatting

mutation {
updateCart(
input: {
id: ID!,
currency: {
code: CurrencyCode
}
}
) {
currency {
code
symbol
thousandsSeparator
decimalSeparator
decimalDigits
}
}
}

Bring your own cart

Build the perfect cart to fit your requirements. The cart below is built with Next.js, React & Apollo Client.

Navy Snapback

$15.95

Silver Snapback

$13.95

Blue Snapback

$12.95

Cart0

The cart is empty

Total$0.00

You're invited

We're currently onboarding users looking for a better cart management API. Want in? Share your details below and we'll be in touch.