useCheckoutAction
hook enables interactions with checkout actions in a type-safe manner, automatically updating the checkout session upon successful execution.
ADD_ITEMS
- Add items to the cartREMOVE_ITEMS
- Remove items from the cartUPDATE_COUPONS
- Update coupon codesUPDATE_CUSTOMER_DETAILS
- Update customer informationUPDATE_ITEMS_QUANTITY
- Update quantities of items in the cartUPDATE_SHIPPING_PACKAGES
- Update shipping packagesUPDATE_SHIPPING_ADDRESSES
- Update shipping addressesUPDATE_PAYMENT_METHODS
- Update payment methodsCREATE_ORDER
- Create a new orderactionType: ActionType
- The type of checkout action to perform (e.g., ADD_ITEMS
, REMOVE_ITEMS
, etc.)callback?: object
- Optional configuration callbacks
onSuccess?: (data?: CheckoutSession) => void
- Called when action succeedsonError?: ({ serverError, validationErrors }) => void
- Called when action failsexecute: (input: Input) => void
- Function to dispatch the action with the appropriate payloadisPending: boolean
- Boolean indicating if the action is currently processingerror?: object
- Error information if the action failed
serverError?: ServerError
- Error returned by the servervalidationErrors?: ValidatorErrors<Input>
- Input Validation errors