Checkout Mutations
This section documents the GraphQL mutations available for managing the checkout process in the YSCP platform. Checkout mutations allow you to set shipping and billing addresses, select shipping methods, and complete the checkout process.
Available Mutations
The following checkout mutations are available:
- PlaceOrder - Completes the checkout process and creates an order
- SetBillingAddressOnCheckoutMutation - Sets the billing address for the checkout
- SetGuestEmailOnCheckoutMutation - Sets the guest email address for the checkout
- SetPaymentMethodOnCheckoutMutation - Sets the payment method for the checkout
- SetShippingAddressOnCheckoutMutation - Sets the shipping address for the checkout
- SetShippingMethodOnCheckoutMutation - Sets the shipping method for the checkout
Common Parameters
Most checkout mutations require the following parameters:
cartId: The unique identifier of the cart to operate onsiteId: (Optional) The site ID where the checkout is being performed
Checkout Flow
The typical checkout flow involves the following steps:
- Create a cart and add products (using cart mutations)
- Set the billing address (using SetBillingAddressOnCheckoutMutation)
- Set the shipping address (if different from billing)
- Get available shipping methods (using AvailableShippingMethodsQuery)
- Select a shipping method (using SetShippingMethodOnCheckoutMutation)
- Get available payment methods (using AvailablePaymentMethodsQuery)
- Select a payment method and complete the checkout
Error Handling
Checkout mutations may return errors in the following cases:
- Invalid cart ID
- Invalid address information
- Shipping method not available for the specified address
- Required fields missing
Each error includes a message explaining the issue and how to resolve it.