Setting the name on a draft order

trowland_noram
New Member
1 0 0

I'm attempting to create a draft order, however when I attempt to set its name in the fields, Shopify seems to be overwriting it.

 

 

"draft_order" => [
    "name" => "Test134"
    "line_items" => [
      0 => array:2 [
        "variant_id" => "20545084948534"
        "quantity" => 1
      ]
    ]
    "customer" => [
      "id" => 2289395662902
    ]
    "tax_exempt" => false
  ]
]

However hen I look the order up in the UI, I see something like "#D187", which is a far cry from what I was trying to set it. 

 

Looking at the documentation, I don't see where name shouldn't be provided, so I'm wondering if it's a field that is intentionally ignored or if this is a bug?

 

Context, I'm using this spec.

https://help.shopify.com/en/api/reference/orders/draftorder#create-2019-07

 

Replies 8 (8)
Ryan
Shopify Staff
Shopify Staff
499 42 120

Hi @trowland_noram,

 

name is not a writeable field on Orders or Draft Orders, therefore it is ignored on the creation which is why your call works but doesn't set the name.  The only way to edit the formatting of the name is to add a prefix or suffix to the standard naming.  You can specify these in /admin/settings/general of the store's admin, note this only applies for orders, and not draft orders which I believe will always be #D1, #D2... etc

 

Hope this helps,

Ryan

Ryan | 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 the Shopify Help Center or the Shopify Blog

mjdth
Shopify Partner
13 1 3

When creating a new (non-draft) Order if you supply the Name field it will correctly name the order. If you try to update the Order with a new name it does nothing.

 

With draft orders it doesn't have any effect if you supply a name during creation or during an edit. The documentation does not say anywhere that Name is read-only for draft orders.

 

Is there some other way to get a draft order or regular order named correctly?

Bikes-Angel
Explorer
59 0 21

That doesn't help.  Who on earth wants something going to the customer saying D1  or D2 etc  (especially D1  gee customer, we've never done this before....   😞  )  All developers should be forced to open up a business and use their product.

baxterbotanical
New Member
1 0 0

I'm having thew exact same issue! I have a wholesale order to send titled 'D3'. How do we change it?? 

dv_ie
Excursionist
11 0 9

A possible work-around for this might be to set a custom "note_attributes" item, such as:

 

"note_attributes": [
  {
    "name": "custom_name",
    "value": "My Custom Order"
  }
]

 

zafarali
New Member
1 0 0

we can set an order name by define and Assign name index in order_array/order_json.

 

like this : name = 'order_name',

Skepibrothers
New Member
1 0 1

Is this still the case? Having to send a generic "#D1" invoice  to a customer is not a great experience.

kaganader
New Member
2 0 2

Is this still not fixed? This seems to be such a simple problem for shopify to fix on their backend to allow us the option to rename Draft names to our own choosing.