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
mutation {
setGuestEmailOnCart(
input: SetGuestEmailOnCartInput
) {
SetGuestEmailOnCartOutput
}
}
Request
saveCopyzoom_out_mapmutation {
setGuestEmailOnCart(
input: {
cart_id: "2U1u9wHHOFNR3UAnBWMTznJfyKA74ZIc"
email: "developer@admin.com"
}
) {
cart {
email
}
}
}
Response
saveCopyzoom_out_map{
"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.
Related Keywords
Magento 2 guest emailSet guest email GraphQLMagento 2 cart APIGraphQL set email MagentoE-commerce cart customizationMagento 2 email integrationGraphQL Magento tutorialGuest checkout Magento 2Magento email APIMagento 2 GraphQL cart