Skip to main content
Version: 2.0.0

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

CategoryDescription
Cart MutationsCreate carts, add/update/remove items, apply coupons and gift cards, and convert between guest and customer carts.
Checkout MutationsSet addresses, choose a shipping method, set a payment method, and place the order.
Customer MutationsManage newsletter subscriptions, wishlists, and saved addresses.
Purchase MutationsCancel orders for authenticated customers or guests.

All registered mutation operations

Cart

OperationDescription
createGuestCartCreate a new anonymous cart and return its ID.
createCustomerCartCreate (or retrieve the active) cart for the authenticated customer.
addProductsToCartAdd one or more products to a cart by SKU/handle.
updateCartItemsChange quantity or custom data on existing cart items.
removeItemFromCartRemove a single item from the cart by item ID.
applyCouponToCartApply a coupon code to the cart.
applyGiftCardToCartApply a gift card code to the cart.
removeCouponFromCartRemove the active coupon from the cart.
removeGiftCardFromCartRemove an applied gift card from the cart.
clearCartRemove all items from the cart.
convertGuestCartToCustomerCartMerge a guest cart into the authenticated customer's cart after login.
convertCustomerCartToGuestCartConvert a customer cart back to a guest cart on logout.
setGuestEmailOnCartAttach an email address to a guest cart for order confirmation.

Checkout

OperationDescription
setBillingAddressOnCheckoutSet or update the billing address for the current checkout.
setShippingAddressOnCheckoutSet or update the shipping address for the current checkout.
setShippingMethodOnCheckoutSelect a shipping method for the current checkout.
setPaymentMethodOnCheckoutSelect a payment method for the current checkout.
placeOrderFinalise checkout and create an order from the cart.

Customer

OperationDescription
subscribeCustomerSubscribe the customer to the store newsletter.
unsubscribeCustomerUnsubscribe the customer from the store newsletter.
addToWishlistAdd a product to the authenticated customer's wishlist.
removeFromWishlistRemove a product from the authenticated customer's wishlist.
clearWishlistRemove all items from the authenticated customer's wishlist.
saveAddressCreate or update a saved address on the customer account.

Purchase

OperationDescription
cancelCustomerOrderCancel an order belonging to the authenticated customer.
cancelGuestOrderCancel 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/