1

I am getting below data on

customer data GraphQL query

const query = () => ({
  query: 
    {
      customer {
        customer_id
        firstname
        lastname
        suffix
        email
        addresses {
          id
          firstname
          lastname
          street
          city
          default_billing
          default_shipping
          region {
            region_code
            region
          }
          postcode
          country_code
          telephone
        }
      }
    }
  
})
{
  customer: {
    id: null,
    firstname: 'User',
    lastname: 'User',
    suffix: null,
    email: 'User@user.com',
    addresses: []
  }
}

How to get customer id in this ?

1

In graphql id is deprecated!

When you see schema for customer, it will show id is deprecated!

enter image description here

As per file

id is not needed as part of Customer because on server side it can be identified based on customer token used for authentication. There is no need to know customer ID on the client side.

Reference

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.