magento-2
How-to, Ecommerce, Magento, Magento 2 Tutorials, Tips & Tricks

How to Get Customer Info using GraphQL in Magento 2?

To retrieve customer information in Magento 2 using GraphQL, you can run the following query:

query {
  customer {
    email
    firstname
    lastname
    addresses {
      firstname
      lastname
      street
      city
      region {
        region_code
        region
      }
      postcode
      country {
        code
        label
      }
    }
  }
}

This query will return the customer’s email, first name, last name, and a list of addresses associated with the customer, including the first name, last name, street, city, region (code and name), postcode, and country (code and label) for each address.

Note:- You will need to include an authentication token in the request header in order to access the customer information.

Posted by
Editorial Staff

Editorial Staff at WebShouters is a team of experts.

Leave a Reply

Your email address will not be published. Required fields are marked *