Development discussions around Shopify APIs
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:
There is really no way for me to fix this that I can find.
Ted
Solved! Go to the solution
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
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
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
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
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
Same issue on my end - any luck in figuring out how to assign a customer to an existing order?
User | RANK |
---|---|
51 | |
11 | |
8 | |
6 | |
6 |
Thanks to all who participated in our AMA with 2H Media on planning your 2023 marketing bu...
By Jacqui Mar 30, 2023Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023