Skip to main content

Mutations

addItemToOrder

"""
Adds an item to the order. If custom fields are defined on the OrderLine entity, a third argument 'customFields' will be available.
"""
type Mutation {
addItemToOrder(productVariantId: ID!, quantity: Int!): UpdateOrderItemsResult!
}

addPaymentToOrder

"""
Add a Payment to the Order
"""
type Mutation {
addPaymentToOrder(input: PaymentInput!): AddPaymentToOrderResult!
}

adjustOrderLine

"""
Adjusts an OrderLine. If custom fields are defined on the OrderLine entity, a third argument 'customFields' of type OrderLineCustomFieldsInput will be available.
"""
type Mutation {
adjustOrderLine(orderLineId: ID!, quantity: Int!): UpdateOrderItemsResult!
}

applyCouponCode

"""
Applies the given coupon code to the active Order
"""
type Mutation {
applyCouponCode(couponCode: String!): ApplyCouponCodeResult!
}

authenticate

"""
Authenticates the user using a named authentication strategy
"""
type Mutation {
authenticate(input: AuthenticationInput!, rememberMe: Boolean): AuthenticationResult!
}

createCustomerAddress

"""
Create a new Customer Address
"""
type Mutation {
createCustomerAddress(input: CreateAddressInput!): Address!
}

deleteCustomerAddress

"""
Delete an existing Address
"""
type Mutation {
deleteCustomerAddress(id: ID!): Success!
}

login

"""
Authenticates the user using the native authentication strategy. This mutation is an alias for authenticate({ native: { ... }})
The rememberMe option applies when using cookie-based sessions, and if true it will set the maxAge of the session cookie
to 1 year.
"""
type Mutation {
login(username: String!, password: String!, rememberMe: Boolean): NativeAuthenticationResult!
}

logout

"""
End the current authenticated session
"""
type Mutation {
logout: Success!
}

refreshCustomerVerification

"""
Regenerate and send a verification token for a new Customer registration. Only applicable if authOptions.requireVerification is set to true.
"""
type Mutation {
refreshCustomerVerification(emailAddress: String!): RefreshCustomerVerificationResult!
}

registerCustomerAccount

"""
Register a Customer account with the given credentials. There are three possible registration flows:
If authOptions.requireVerification is set to true:
1. The Customer is registered with a password. A verificationToken will be created (and typically emailed to the Customer). That
verificationToken would then be passed to the verifyCustomerAccount mutation without a password. The Customer is then
verified and authenticated in one step.
2. The Customer is registered without a password. A verificationToken will be created (and typically emailed to the Customer). That
verificationToken would then be passed to the verifyCustomerAccount mutation with the chosen password of the Customer. The Customer is then
verified and authenticated in one step.
If authOptions.requireVerification is set to false:
3. The Customer must be registered with a password. No further action is needed - the Customer is able to authenticate immediately.
"""
type Mutation {
registerCustomerAccount(input: RegisterCustomerInput!): RegisterCustomerAccountResult!
}

removeAllOrderLines

"""
Remove all OrderLine from the Order
"""
type Mutation {
removeAllOrderLines: RemoveOrderItemsResult!
}

removeCouponCode

"""
Removes the given coupon code from the active Order
"""
type Mutation {
removeCouponCode(couponCode: String!): Order
}

removeOrderLine

"""
Remove an OrderLine from the Order
"""
type Mutation {
removeOrderLine(orderLineId: ID!): RemoveOrderItemsResult!
}

requestPasswordReset

"""
Requests a password reset email to be sent
"""
type Mutation {
requestPasswordReset(emailAddress: String!): RequestPasswordResetResult
}

requestUpdateCustomerEmailAddress

"""
Request to update the emailAddress of the active Customer. If authOptions.requireVerification is enabled
(as is the default), then the identifierChangeToken will be assigned to the current User and
a IdentifierChangeRequestEvent will be raised. This can then be used e.g. by the EmailPlugin to email
that verification token to the Customer, which is then used to verify the change of email address.
"""
type Mutation {
requestUpdateCustomerEmailAddress(password: String!, newEmailAddress: String!): RequestUpdateCustomerEmailAddressResult!
}

resetPassword

"""
Resets a Customer's password based on the provided token
"""
type Mutation {
resetPassword(token: String!, password: String!): ResetPasswordResult!
}

setCustomerForOrder

"""
Set the Customer for the Order. Required only if the Customer is not currently logged in
"""
type Mutation {
setCustomerForOrder(input: CreateCustomerInput!): SetCustomerForOrderResult!
}

setOrderBillingAddress

"""
Sets the billing address for this order
"""
type Mutation {
setOrderBillingAddress(input: CreateAddressInput!): ActiveOrderResult!
}

setOrderCustomFields

"""
Allows any custom fields to be set for the active order
"""
type Mutation {
setOrderCustomFields(input: UpdateOrderInput!): ActiveOrderResult!
}

setOrderShippingAddress

"""
Sets the shipping address for this order
"""
type Mutation {
setOrderShippingAddress(input: CreateAddressInput!): ActiveOrderResult!
}

setOrderShippingMethod

"""
Sets the shipping method by id, which can be obtained with the eligibleShippingMethods query.
An Order can have multiple shipping methods, in which case you can pass an array of ids. In this case,
you should configure a custom ShippingLineAssignmentStrategy in order to know which OrderLines each
shipping method will apply to.
"""
type Mutation {
setOrderShippingMethod(shippingMethodId: [ID!]!): SetOrderShippingMethodResult!
}

transitionOrderToState

"""
Transitions an Order to a new state. Valid next states can be found by querying nextOrderStates
"""
type Mutation {
transitionOrderToState(state: String!): TransitionOrderToStateResult
}

updateCustomer

"""
Update an existing Customer
"""
type Mutation {
updateCustomer(input: UpdateCustomerInput!): Customer!
}

updateCustomerAddress

"""
Update an existing Address
"""
type Mutation {
updateCustomerAddress(input: UpdateAddressInput!): Address!
}

updateCustomerEmailAddress

"""
Confirm the update of the emailAddress with the provided token, which has been generated by the
requestUpdateCustomerEmailAddress mutation.
"""
type Mutation {
updateCustomerEmailAddress(token: String!): UpdateCustomerEmailAddressResult!
}

updateCustomerPassword

"""
Update the password of the active Customer
"""
type Mutation {
updateCustomerPassword(currentPassword: String!, newPassword: String!): UpdateCustomerPasswordResult!
}

verifyCustomerAccount

"""
Verify a Customer email address with the token sent to that address. Only applicable if authOptions.requireVerification is set to true.
If the Customer was not registered with a password in the registerCustomerAccount mutation, the password must be
provided here.
"""
type Mutation {
verifyCustomerAccount(token: String!, password: String): VerifyCustomerAccountResult!
}