GraphQL Mutations
yStore registers GraphQL mutations through YuiCraftPlugin for every write operation a storefront needs: managing carts, progressing through checkout, handling customer accounts and wishlists, and working with orders. All mutations return typed objects so you can immediately read back the updated state.
Mutation categories
| Category | Description |
|---|---|
| Cart Mutations | Create carts, add/update/remove items, apply coupons and gift cards, and convert between guest and customer carts. |
| Checkout Mutations | Set addresses, choose a shipping method, set a payment method, and place the order. |
| Customer Mutations | Manage newsletter subscriptions, wishlists, and saved addresses. |
| Purchase Mutations | Cancel orders for authenticated customers or guests. |
All registered mutation operations
Cart
| Operation | Description |
|---|---|
createGuestCart | Create a new anonymous cart and return its ID. |
createCustomerCart | Create (or retrieve the active) cart for the authenticated customer. |
addProductsToCart | Add one or more products to a cart by SKU/handle. |
updateCartItems | Change quantity or custom data on existing cart items. |
removeItemFromCart | Remove a single item from the cart by item ID. |
applyCouponToCart | Apply a coupon code to the cart. |
applyGiftCardToCart | Apply a gift card code to the cart. |
removeCouponFromCart | Remove the active coupon from the cart. |
removeGiftCardFromCart | Remove an applied gift card from the cart. |
clearCart | Remove all items from the cart. |
convertGuestCartToCustomerCart | Merge a guest cart into the authenticated customer's cart after login. |
convertCustomerCartToGuestCart | Convert a customer cart back to a guest cart on logout. |
setGuestEmailOnCart | Attach an email address to a guest cart for order confirmation. |
Checkout
| Operation | Description |
|---|---|
setBillingAddressOnCheckout | Set or update the billing address for the current checkout. |
setShippingAddressOnCheckout | Set or update the shipping address for the current checkout. |
setShippingMethodOnCheckout | Select a shipping method for the current checkout. |
setPaymentMethodOnCheckout | Select a payment method for the current checkout. |
placeOrder | Finalise checkout and create an order from the cart. |
Customer
| Operation | Description |
|---|---|
subscribeCustomer | Subscribe the customer to the store newsletter. |
unsubscribeCustomer | Unsubscribe the customer from the store newsletter. |
addToWishlist | Add a product to the authenticated customer's wishlist. |
removeFromWishlist | Remove a product from the authenticated customer's wishlist. |
clearWishlist | Remove all items from the authenticated customer's wishlist. |
saveAddress | Create or update a saved address on the customer account. |
Purchase
| Operation | Description |
|---|---|
cancelCustomerOrder | Cancel an order belonging to the authenticated customer. |
cancelGuestOrder | Cancel a guest order identified by order number and email. |
info
placeOrder returns a payment URL for redirect-based gateways. Your storefront should check the response for a payment_url field and redirect the customer accordingly before polling for order status.
Source files
Mutations are registered from:
src/gql/mutations/cart/src/gql/mutations/checkout/src/gql/mutations/customer/src/gql/mutations/purchase/