Magento 2 How to set guest email on the cart using GraphQL
For guest customers, we need to email the cart before placing an order. So the following article teach the how to set guest email on the cart using GraphQL.
Syntax
Copy
mutation {
setGuestEmailOnCart(
input: SetGuestEmailOnCartInput
) {
SetGuestEmailOnCartOutput
}
}
Request
Copy
mutation {
setGuestEmailOnCart(
input: {
cart_id: "2U1u9wHHOFNR3UAnBWMTznJfyKA74ZIc"
email: "developer@admin.com"
}
) {
cart {
email
}
}
}
Response
Copy
{
"data": {
"setGuestEmailOnCart": {
"cart": {
"email": "developer@admin.com"
}
}
}
}
That's it!!
If you are looking for more GraphQL solutions then check out our another article which is List of GraphQL Queries and Mutations for Magento 2.
I hope this article helps you to find what you were looking for.
Bookmark it for your future reference. Do comment below if you have any other questions on that.
P.S. Do share this article with your team.