Change the customer on an

Solved
Ted_Schroeder
New Member
2 1 0

We allow "guest" orders which means that many of our customers don't have an account, so they sometimes type in their email address incorrectly. Often this isn't a problem because I can just change the notification email address, but when the notification email address already exists it won't let you do this. I was looking through the Shopify API today and saw that you are supposed to be able to remove a customer from an order. So I thought, great. I'll remove the customer and then add a new customer using this PUT interface. But no dice.

 

Remove the customer from an order

 

PUT /admin/api/2020-04/orders/#{order_id}.json
{
  "order": {
    "id": 450789469,
    "customer": null
  }
}

When I try to do this (all our orders are automatically fulfilled once they are paid for as we have an all digital site) it won't let me, although the API returns a "200 OK". First of all, if you aren't allowed to do this for orders in certain states, the documentation should certainly state this. Secondly, you should NEVER return a "200 OK" when something doesn't do what you asked it to do. Third, is there some way for me to change the customer on an order or at least change the confirmation email to one that already exists?

Here's the exact case I get on a regular basis:

 

  • A customer who has ordered from us before orders again
  • They mistype their email address on the second order
  • They never get their confirmation email, so they think we ripped them off

There is really no way for me to fix this that I can find.

 

Ted

 

 

0 Likes
_JB
Shopify Staff
Shopify Staff
750 86 163

This is an accepted solution.

Hey @Ted_Schroeder,

 

Can you provide a few order_id examples where you've seen this behaviour, as well as a rough timeframe of when you made those API calls?

 

I just tested these API calls on my own store, but I was able to remove/change the customer as expected, no matter the state of the order. There's likely something different between my test store and your store, so if you provide some examples I can check and hopefully see what's happening. 

JB | 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

0 Likes
Ted_Schroeder
New Member
2 1 0

This is an accepted solution.

My bad. I just went through my code and I had tried to set the customer id to null instead of setting the whole customer field to null.

 

My apologies. Thanks for looking into this.

 

Ted

0 Likes