Mutations
GraphQL mutations explained — checkout, coupons, and account changes.
Mutations change data on StoreOS — place orders, update profiles, log in. Most need x-tenant; some also need a customer JWT.
Checkout
createOrder
What it does: Places an order — converts cart line items into an invoice on StoreOS. This is the main checkout action.
Who can call: Guests (no JWT) or logged-in customers (with JWT).
What you send: Line items, shipping address, payment method (COD or ONLINE), delivery area, optional coupon.
What you get back: Order with invoiceUID, optional authToken for guest tracking.
mutation CreateOrder($input: CreateOrderInput!) {
createOrder(input: $input) {
order { invoiceUID invoiceStatus netTotalAmount }
authToken
customer { _id name email phoneNumber }
}
}REST equivalent: POST /api/v1/orders · SDK: createOrder()
verifyCoupon
What it does: Checks if a discount code is valid for the current cart and returns the discount amount.
Why line items are required: StoreOS validates the coupon against specific products and quantities.
mutation VerifyCoupon($input: VerifyCouponInput!) {
verifyCoupon(input: $input) {
valid discountAmount message
}
}Input needs code + lineItems[] with productId, variantId, quantity.
REST equivalent: POST /api/v1/orders/coupons/verify · SDK: verifyCoupon()
Account
updateProfile · changePassword
| Mutation | What it does | Auth |
|---|---|---|
updateProfile | Change name, phone, shipping address | Required |
changePassword | Change password (returns Boolean) | Required |
mutation UpdateProfile($input: UpdateProfileInput!) {
updateProfile(input: $input) { _id name email phoneNumber }
}REST equivalent: PATCH /api/v1/auth/profile, POST /api/v1/auth/change-password
cancelOrder
What it does: Cancels an order the logged-in customer placed.
Input: orderId (invoice UID) + optional reason.
mutation CancelOrder($input: CancelOrderInput!) {
cancelOrder(input: $input) {
invoiceUID invoiceStatus
}
}REST equivalent: POST /api/v1/orders/:orderId/cancel · SDK: cancelOrder()
Order lifecycle reference
Invoice status (invoiceStatus)
| Status | Meaning |
|---|---|
PENDING | Placed, awaiting processing |
PROCESSING | Being prepared |
SHIPMENT_IN_PROGRESS | Handed to courier |
SHIPMENT_IN_TRANSIT | In transit |
SHIPMENT_DELIVERED | Delivered |
REJECTED | Rejected / cancelled |
Payment status (paymentStatus)
UNATTEMPTED · PROCESSING · PAID · CANCELLED · FAILED · EXPIRED
Delivery areas
Bangladesh divisions: DHAKA, CHATTOGRAM, SYLHET, RAJSHAHI, KHULNA, BARISHAL, RANGPUR, MYMENSINGH, OUTSIDE_CAPITAL.
Fees come from storeFront.charges — fetch with storeFront query or getTenant().