ShopifyAPI - line item properties on Order/Draft Order creation

Shopify Partner
8 0 0

Working on my first Sinatra app with the shopify_api gem, hoping someone can shed some light on this (the available docs do not seem to).

This, for example, successfully creates a new draft order, but the properties are ignored in the creation of the line item.

ShopifyAPI::DraftOrder.create(
  :line_items => [
    {
      :variant_id => 33806275085,
      :quantity => 1,
      :properties => [
        { :foo => "Bar" }
      ]
    }
  ]
)

A syntax error, perhaps? Or is inclusion of properties in this way not permitted? Something else? Apologies in advance for any noob-ish-ness.

0 Likes
Shopify Partner
8 0 0

.. or am I posting about this in the wrong forum? Anyone?

0 Likes
Shopify Partner
8 0 0

And the same is true for the standard Orders API:

ShopifyAPI::Order.create(
  :line_items => [
    {
      :variant_id => 123456789,
      :quantity => 1,
      :properties => [
        { :foo => "Bar" }
      ]
    }
  ]
)

An order is successfully created, but no properties/attributes to be found. Am I barking up the wrong tree here?

0 Likes

Any update on this issue @shopify?

We have a similar problem: An order attribute can be "created" from storefront by sending it as properties but not from GraphQL API.

0 Likes
Shopify Partner
1843 170 537

Hi Ehsan Khakbaz

In GraphQL API it's not called 'properties' but customAttributes which is an Attribute! object type. Tried, works.

Hope that helps!

I turn coffee in to code - since 1998
0 Likes

Hi @KarlOffenberger,

0 Likes
Highlighted
Tourist
3 0 0

Line item properties, cart attributes, note attributes should be added as array of objects in the form of 

{
 "name":"__insert_property_name__",
 "value":"__insert_property_value__" 
}
0 Likes