Setting the name on a draft order

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
462 34 90

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