Skip to content

Instantly share code, notes, and snippets.

@yanns
Created February 14, 2019 15:45
Show Gist options
  • Save yanns/98f0751094090c198ebd9be39cb9fcf0 to your computer and use it in GitHub Desktop.
Save yanns/98f0751094090c198ebd9be39cb9fcf0 to your computer and use it in GitHub Desktop.
checkout graphql
mutation CreateCart {
createCart(draft: {
currency: "USD"
origin: Customer
lineItems: [
{
productId: "<product-id>"
variantId: 1
}
]
}) {
id
version
origin
lineItems {
productId
variant {
id
}
}
}
}
mutation UpdateCart($$id: String!) {
updateCart(
id: $$id
version: 1
actions: [
{ setCustomerEmail: { email: "my-email@bar.com" } }
{ setShippingAddress: { address: { country: "US" } } }
]
) {
version
}
}
mutation {
createOrderFromCart(draft: {
id : "<cart-id>"
version : 1
}) {
id
country
origin
shippingAddress {
country
}
lineItems {
id
productId
name (locale: "en")
quantity
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment