joecritch
joecritch

Reputation: 1105

Are line item properties exposed in the Shopify Order API?

Is it possible to retrieve the custom properties (see here http://wiki.shopify.com/Line_Item_Properties) for all the order's line items within the Order API?

I need to create a custom report for all orders, but they rely on displaying these properties.

Upvotes: 3

Views: 2143

Answers (1)

David Underwood
David Underwood

Reputation: 4966

Line item properties are exposed by default through the Order API where they exist. Here's an example line-items XML snippet, notice the 'Monogram' property at the bottom:

<line-items type="array">
  <line-item>
    <id type="integer">223039148</id>
    <requires-shipping type="boolean">true</requires-shipping>
    <fulfillment-service>manual</fulfillment-service>
    <grams type="integer">0</grams>
    <price type="decimal">9.99</price>
    <quantity type="integer">1</quantity>
    <sku/>
    <title>All the Tests</title>
    <product-id type="integer">90620559</product-id>
    <variant-id type="integer">212221205</variant-id>
    <vendor>soundcloud</vendor>
    <variant-title nil="true"/>
    <fulfillment-status nil="true"/>
    <name>All the Tests</name>
    <variant-inventory-management/>
    <properties type="array">
      <property>
        <name>Monogram</name>
        <value>omg</value>
      </property>
    </properties>
  </line-item>
</line-items>

Note that the properties array will be absent if it's empty, so make sure you cater for that in your code.

Upvotes: 6

Related Questions