Frontend API
Methods to retrieve order details and convert the cart to an order.
When a cart is submitted, the newly created order will be returned. However, you can use this method if you need to get the order information separately. You can also retrieve an order with a checkout_id, allowing you to display order details from an email containing a link like https://my-store.com/order/{checkout_id}.
Returns order with the passed ID, or if no parameters are passed, the last order placed in the current session.
await swell.cart.getOrder('878663b2fb4175b128e40de428cd7b0c')When a customer has entered all the information needed to finalize their order, call this method to process their payment and convert the cart to an order.
Returns the newly created order.
await swell.cart.submitOrder()
Methods to retrieve order details and convert the cart to an order.
Get order details
When a cart is submitted, the newly created order will be returned. However, you can use this method if you need to get the order information separately. Returns the last order placed in the current session.
The parameters for this query are _locale, and _currency.
query {
cart {
dateCreated
checkoutId
orderId
accountId
account {
name
email
group
}
items {
product {
id
name
price
}
quantity
price
}
grandTotal
taxTotal
discountTotal
}
}Submit an order
When a customer has entered all the information needed to finalize their order, call this method to process their payment and convert the cart to an order. Returns the newly created order.
The parameters for this query are _locale, and _currency.
mutation {
submitCartOrder {
id
accountId
items {
product {
id
name
price
}
quantity
taxTotal
priceTotal
discountTotal
}
}
}