DraftOrderCalculate mutation creates customers as a side effects

DraftOrderCalculate mutation creates customers as a side effects

Shopify Partner
17 0 0

My flow is currently as follows:

  1. calculate an order with draftOrderCalculate
  2. Create a shopify customer if one doesn't exist
  3. Create a draft order attached to customer from #2
  4. Complete the draft order

This results in every order creating 1 legitimate customer from step 2 and N illegitimate customers from step 1 based on how many time draftOrderCalculate was called.

DraftOrderCalculate seems to have the side effect of creating phantom customers. The customers dont exist until after the order has been completed.


1. calculate a draft order with shipping address and NO email or customer id
2. calculate it multiple times
3. create draft order with same address used in the calculation
4. complete draft order
5. observe multiple customers created

Attempts to mitigate:

use same email in draft order as customer, check for existing user with that email, and create if not exists - this doesnt work. The check for an existing customer returns "not found" but the creation of the customer fails with "email taken"

use a standard email for calculations - this works, but obviously creates 1 customer attached to the email used for calculations. 


Is this mutation supposed to create customers as a side effect? Can I calculate an order without creating phantom users?

Replies 2 (2)

Shopify Staff
200 27 55

Hi @almax120 ,

In my testing I'm seeing customers created after every draftOrderCalculate call when no customer specific information like email is provided. Doing some internal investigation this is intended behaviour. I wanted to point out that if you provide an email in the draftOrderCalculate for a customer that already exists a new customer will not be created and the draft order will be associated with that existing customer.

Your point about querying for a customer by email and no result being returned, I just wanted to confirm if the APP making the request has read_customer scope.


John C | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Shopify Partner
1 0 0

HI @_JCC_ ,


Thanks so much for your explanation on this issue. 

Can you please let us know why this is an "intended behaviour"?

What if we want to create a draft order with out the email address?