25 Oct 2021
https://api.cartql.com
fragment currencyFields on Currency {
code
symbol
}
fragment moneyFields on Money {
amount
currency {
...currencyFields
}
formatted
}
fragment cartInfo on Cart {
id
totalItems
totalUniqueItems
items {
id
name
quantity
unitTotal {
...moneyFields
}
lineTotal {
...moneyFields
}
}
subTotal {
...moneyFields
}
}
query getCartById($id: ID!) {
cart(id: $id) {
...cartInfo
}
}
mutation addItem($cartId: ID!) {
addItem(
input: {
cartId: $cartId
id: "new-item-id"
name: "New product"
price: 1000
}
) {
...cartInfo
}
}