Change the customer on an

Solved
Ted_Schroeder
Tourist
6 1 4

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

 

 

Accepted Solutions (2)
_JB
Shopify Staff
Shopify Staff
836 100 219

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 | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Ted_Schroeder
Tourist
6 1 4

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

View solution in original post

Replies 5 (5)
_JB
Shopify Staff
Shopify Staff
836 100 219

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 | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Ted_Schroeder
Tourist
6 1 4

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

MatthewReive
New Member
2 0 3

@_JB @Ted_Schroeder 

I have been able to remove a customer from an order with the API put call above, but I have been unsuccessful to add a different customer using the the same PUT.  Is there something that I am missing in this REST API documentation

 

Best Regards,

Matthew Reive
Digital Manager
Interior Couture

jkwanlmr
New Member
1 0 0

Same issue on my end - any luck in figuring out how to assign a customer to an existing order?

Ted_Schroeder
Tourist
6 1 4
Can't be done. Can't merge accounts either. Apparently this is deeply
inherent in the way the original product was designed. They do understand
it's a problem. For whatever that is worth.