Skip to content

How to add additional fields in newsletter subscription mutations in Magento2

How to add additional fields in newsletter mutation?

mutation {
  subscribeEmailToNewsletter(
    email: "[email protected]"
  ) {
    status
  }
}

I want to add firstname & lastname in the above mutation.

I extended the schema.graphql from newsletter module.

But I don’t know how to update these two fields alongs with email address.

default syntax

mutation: {subscribeEmailToNewsletter(email: String!): SubscribeEmailToNewsletterOutput}