Setting the name on a draft order

Highlighted
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

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
486 42 107

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

Developer Experience @ Shopify
0 Likes
Highlighted
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?

1 Like
Highlighted
Excursionist
39 0 8

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.

2 Likes
Highlighted
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?? 

0 Likes