Draft Order API > Customer Name coming back NULL

Ceri-Waters
Shopify Partner
97 4 25

Hiya,

We're in an odd situation..

As part of our App we create Draft Orders using the REST API. We pass in a basic customer object consisting of the first_name, last_name and email address.

99% of the time this works fine, however in some cases the Draft Order is created with an empty customer, with a null email, first_name and last_name field... There's nothing unusual about the values passed in, and repeating the call it then works!?!? (Even on other stores for the first time). Always seems to happen with new customers, but only rarely..

Any ideas? If a Shopify Developer DMs me I can provide a few specific examples.

Thanks in advance,
Ceri.

 

Replies 2 (2)
awwdam
Shopify Staff
172 31 17

Hey @Ceri-Waters,

If you are able to replicate this and log a few details, please share along the following: an example of the raw request body as well as x-request-id response header returned with the unexpected outcome. I'd be happy to take a look and pass back any insights or suggestions - Cheers!

awwdam | API 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

Ceri-Waters
Shopify Partner
97 4 25

Thank you @awwdam !

I discovered what the problem was on Friday, it turns out that another App had been creating customers just prior to ours! (Except without a name)

This meant, that when we were passing along our customer object (with a name) the API was just returning the customer object already present but without the name.

From this, I've suggested 2 changes to support:

  1. Return a read only property on a POST call to the Draft/Order API to indicate if a customer was created or returned
  2. If a customer doesn't have a name, and an order is created for them via the API (with a name) to save it against their account

Thanks,
Ceri.