Checkout UI StoreFront API

Checkout UI StoreFront API

cherriecoder
Shopify Partner
14 0 0

I am having problems with my query. I am trying to access the storefront API to query the customer's information in the checkout extensibility.  

I know we can do useCustomer or buyerIdentity but that's if you're logged in. I want to be able to query the customer's information through email in case theyre not logged in.

 

useEffect(() => {
        query(
          `query getCustomer ($first: Int!, $email: String!) {
            customer(first: $first, query: $email) {
              id
              email
              firstName
              lastName
            }
          }`,
          {
            variables: { first: 1, email: `email:${customerEmail}` },
          }
        ).then(({data, errors}) => {
            console.log('data', data);
          })
  },[customerEmail, shippingAddress, customer, query])

and I get this error

message: "Field 'customer' is missing required arguments: customerAccessToken"

 

Reply 1 (1)

philhooper1
Shopify Partner
1 0 0

I'd like to bump this ticket. We are also having the same issue with only being able to view the data when the user is logged in. 

If not, we are getting the same error; "Field 'customer' is missing required arguments: customerAccessToken"

 

Please advise Shopify?