How To Get Logged-in Customer Details By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

The following below steps need to follow to get logged-in Customer Details By Using GraphQL in Magento 2.x / Adobe Commerce 2.x

Step [1] – Recommendation to use below customer customer syntax

Here Using Postman

Syntax –

{customer: {Customer}}

Step [2] – Put below Request

{
  customer {
    firstname
    lastname
    suffix
    email
    addresses {
      firstname
      lastname
      street
      city
      region {
        region_code
        region
      }
      postcode
      country_code
      telephone
    }
  }
}

Step [3] – Below output response

{
    "data": {
        "customer": {
            "firstname": "John",
            "lastname": "Donald",
            "suffix": null,
            "email": "johndusa1021@gmail.com",
            "addresses": [
                {
                    "firstname": "John",
                    "lastname": "Donald",
                    "street": [
                        "D-101, New York"
                    ],
                    "city": "New York",
                    "region": {
                        "region_code": "NY",
                        "region": "New York"
                    },
                    "postcode": "12345",
                    "country_code": "US",
                    "telephone": "99xxxxxxxx"
                }
            ]
        }
    }
}

Leave a Reply

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