Shopify silently omits address from orders if last_name not specified

Tourist
10 0 0

We have an app that creates shopify orders, and have noticed that if you do not specify a ‘last name’ in the shipping/billing address then Shopify will silently just leave that address out of the order entirely. This seems like a bug in Shopify, can anyone confirm?

0 Likes
Shopify Staff
Shopify Staff
462 34 90

Hi @seshna,

 

I can confirm this behaviour, and I would say this is not a bug.  When creating an order through the API, shipping and billing addresses are not required.  However, when they are included they require a last name.  So when you are leaving out the last name, it will be recognized as incomplete and therefore dropped from the request, which will be created with the rest of the parameters.  In most situations this is preferable to failing the order creation, but I can see how it may cause some confusion in a case like this.

 

Regards,

Ryan

 

Developer Experience @ Shopify
0 Likes
Tourist
10 0 0

Thank you for responding @Ryan 

 

that seems kind of inconsistent.

Is there anywhere these rules are listed? because there is no feedback from the API to let us know that the order was compromised, and we would like to provide assurance to our client that this will not happen again

0 Likes
Shopify Staff
Shopify Staff
462 34 90

The feedback would be the order object that is returned from the POST call, that has an empty array for address.  Unfortunately there is no way to return errors on the successful creation of an order.

Developer Experience @ Shopify
0 Likes
Tourist
10 0 0

@Ryan 

The bit that doesnt make sense is, you can create an order in the Shopify Admin without giving the customer a last name, and it works fine.

The webhooks push the order and address to our app, and the last name is blank.

Why can you create an order (with no last name in the address) in Shopify, and receive that order (with that address), but you cannot create that exact same order via the API?

I also feel it worth mentioning that as far as I know this behaviour is completely undocumented as well, so we dont know what other fields are required

0 Likes