Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Can't update order.name (not number) using Order API PUT

Can't update order.name (not number) using Order API PUT

Marius_from_Sup
Shopify Partner
179 0 32

We're trying to update order.name (not number) on existing orders via Order API PUT
https://help.shopify.com/api/reference/order

(for some specific orders, we require a specific different prefix)

The API call returns success, but the order name isn't updated.
If we try to also update order.note in the same call, for testing, the note is updated, but name isn't.

Would you have any insight on how to update order names?

Thanks,

Streamline your shop and sell more http://www.suppleApps.com
Replies 17 (17)

Kraken42
Pathfinder
265 0 29

Is the name in the correct format? The documentation seems to imply that it must be numeric after the prefix.

Marius_from_Sup
Shopify Partner
179 0 32

Thanks Adrian,

Original order.name is '#2500'

We're trying to set it to 'PRE#2500'

We need to change only the prefix, not the number. Is there a way to update prefix separately for an existing order?

Or, somehow, specify a custom prefix when creating a new order using POST? (this must be possible, as the POS orders have a different prefix) -- this would still be better than nothing, even if PUT doesn't work for now.

(we don't want to change shop settings prefix, create the order, and then change shop settings prefix back to original)

Streamline your shop and sell more http://www.suppleApps.com

heyhost
Shopify Partner
106 1 18

Is 'name' an updatable property? It's vague in the docs, but there's only a handful of order properties that can be updated by the API.

>"You should also note that you can change only a few of an order's attributes using the API."

You can modify: note, email, buyer-accepts-marketing, or remove the customer association, but not sure about name.

Maybe shopify can confirm the order properties that can be modified via API.

My enthusiasm greatly exceeds my talent.

heyhost
Shopify Partner
106 1 18

If you are unable to modify the name, perhaps setting an order metafield for the prefix could be useful?

My enthusiasm greatly exceeds my talent.

HunkyBill
Shopify Partner
4853 60 568

@heyhost is 100% correct. Once an order is established, there is very little you can do to change it. Minor edits to minor things. 

There is no doubt you can use the API to read an order, and then re-create that exact same order, with the correct name, and then delete the original. 

Many Apps do that to provide the illusion of order editing.

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
AkaiBukai
Tourist
3 0 1

Hello.. I know this post is a little bit old but I wanted to know how if isn't something possible now..
I opened a thread here https://community.shopify.com/c/shopify-apis-and-sdks/how-to-change-an-order-name-as-described-in-th... where I attached part of the doc explicitely telling it's possible to edit the name of an order with the API.

It seems that this is not true and that the documentation might be wrong, I wanted to know how I can proceed by duplicating an order..
I guess that I can duplicate an order by copying the result of a GET request and putting that in a POST request, but I think I should remove some data that exclusively belongs to that previous order (things like IDs etc.) is it possible to know what are the thing to remove if that make sense?

Thank you!

Marius_from_Sup
Shopify Partner
179 0 32

Thanks for confirming, Bill.

Streamline your shop and sell more http://www.suppleApps.com

Jamie_D_
Shopify Staff (Retired)
533 1 92

Order name is immutable. They are generated based on the merchant's preferences. The merchant specifies a prefix and a starting index, and all order names are generated sequentially.

To learn more visit the Shopify Help Center or the Community Blog.

MP4
Tourist
5 0 4

@hunkybill 

 

Thanks for the comment. What about

line_item

properties? 

 

I can DELETE them via UI. Assuming I can UPDATE them via API.

 

HunkyBill
Shopify Partner
4853 60 568

I would not assume anything. I would spend 30 seconds testing the question out though. And prove that changing items is again, immutable. An order is an order is an order. You cannot edit them. Today anyway. For very good reason. If you change an order, the side-effects are numerous. It is way too easy to blow off your leg at the knee compared to helping your cause. 

https://help.shopify.com/api/reference/order

So again, if you need to re-arrange things in an order, blow it away, and remake it as you need it. That way, no editing issues come into play. A script to replay orders takes mere minutes to write, or you can use one of those order editing Apps floating around out there to do same. 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com

MP4
Tourist
5 0 4

Thanks @hunkyBill. 

I agree a script to recreate orders is easy to write. It's notifying all upstream and downstream services of the change that's the issue. 

We may resort to tags to indicate backordered item. It appears they can be updated, added, or removed.

 

I don't think it's your problem. But if there are any Shopify devs/PMs out there:

Aside from not being able to use the API to do what I need - the overarching issue for me is the docs need to be updated to indicate which items I can change.

HunkyBill
Shopify Partner
4853 60 568

@MP,

The documentation is pretty clear on what you can change when you look at the PUT explanation. True though, it is not crystal clear, and that is probably due to it being a rather in-flux endpoint. Order is one of the kingpins of the whole Jenga pile, and if you push/pull on even a small seemingly innocuous piece, the whole pile could tumble down a rabbit hole to Wonderland. We wouldn't want that now would we... 🙂

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com

MP4
Tourist
5 0 4

@HunkyBill, Thanks.

As a dev, you know precision is key. So I think for the docs, if instead of:

"Change an order’s attributes such as note, email, buyer-accepts-marketing, or remove the customer association"

It said:

" You may only change the following order attributes: note, email, buyer-accepts-marketing, or remove the customer association"

That would be crystal clear. 

Now where do I create a PR?

 

Also, since line_item properties are touted as customization options, I think it would be reasonable to open this up:

Use Case: As a customer I set a birthday message, but actually there's a typo in the message, I need to change it.

 

HunkyBill
Shopify Partner
4853 60 568

To me a PR is a pull request. What is PR to you?

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com

MP4
Tourist
5 0 4

Pull request, yea. Implying the API was open-source 🙂

HunkyBill
Shopify Partner
4853 60 568

Shopify is on Github, and anything they publish there in terms of code would have the facility for you to work against. 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com

AkaiBukai
Tourist
3 0 1

Hello.. I know this post is a little bit old but I wanted to know how if isn't something possible now..
I opened a thread here https://community.shopify.com/c/shopify-apis-and-sdks/how-to-change-an-order-name-as-described-in-th... where I attached part of the doc explicitely telling it's possible to edit the name of an order with the API.

It seems that this is not true and that the documentation might be wrong, I wanted to know how I can proceed by duplicating an order..
I guess that I can duplicate an order by copying the result of a GET request and putting that in a POST request, but I think I should remove some data that exclusively belongs to that previous order (things like IDs etc.) is it possible to know what are the thing to remove if that make sense?

Thank you!