Re: Is email guaranteed on order object?

Is customer email always included in the order object?

EricH2
Shopify Partner
8 0 1

I'm subscribed to the orders_create webhook, and I'm wondering if the email (customer email) field is guaranteed in the order object for online, not POS sales. 

Replies 8 (8)

LuffyOnePiece
Shopify Partner
645 93 116

Hi @EricH2 

Email is not a required field. You can have a look at the screenshot below.

SandeepPangeni_0-1707061408225.png



Thank you.

Sandeep Pangeni
Need help with your store? [email protected]
For quick response, Contact In WhatsApp +9779867521184
EricH2
Shopify Partner
8 0 1

Are there any good ways of linking an order to a customer based on the orders_create webhook response data?

LuffyOnePiece
Shopify Partner
645 93 116

@EricH2 

 

In my experience, using the customer ID is an effective method to link orders. By extracting the customer ID from the orders_create webhook response, you can seamlessly connect each order to its respective customer in your system. This approach simplifies tracking and enhances the overall efficiency of order management.

Sandeep Pangeni
Need help with your store? [email protected]
For quick response, Contact In WhatsApp +9779867521184
EricH2
Shopify Partner
8 0 1

I thought that the customer field wasn't guaranteed, and therefore no way to consistently get a customer ID - https://shopify.dev/docs/api/admin-rest/2023-10/resources/order#resource-object

 

LuffyOnePiece
Shopify Partner
645 93 116

When customers enter a phone number or email on the checkout page, a new customer is created during the order process if they're not logged in. This newly created customer is then linked to the order, streamlining the overall order creation and customer management process.

SandeepPangeni_0-1707065445876.png

 

Sandeep Pangeni
Need help with your store? [email protected]
For quick response, Contact In WhatsApp +9779867521184
EricH2
Shopify Partner
8 0 1

Will I get all customer fields with the read_orders access scope, or do I also need customer_read_orders scope?

LuffyOnePiece
Shopify Partner
645 93 116

You need to add read_customers scopes.

https://shopify.dev/docs/api/usage/access-scopes

Sandeep Pangeni
Need help with your store? [email protected]
For quick response, Contact In WhatsApp +9779867521184
EricH2
Shopify Partner
8 0 1

@LuffyOnePiece 

I've updated my shopify.app.appName.toml file to include the read_customers access scope, and tried to deploy the config changes with npm run shopify app deploy. It creates the new version, but doesn't deploy it because I haven't been approved for network access. I'm still in development and not ready to have the app reviewed for publishing. How can I update access scopes without requesting network access?