Skip to main content

Use the sales channel order in a workflow

A sales order in SKU.io carries the fields every channel shares: customer, lines, totals, addresses. Some decisions need fields only the channel has, such as a Shopify order's tags, its note attributes or metafields, or whether an Amazon order is Prime. The Include sales channel order setting adds the original channel order to the trigger's data, so an IF condition or a later step can read it.

Before you begin​

  • You can create and edit workflows.
  • The setting is on these triggers: Sales Order Created, Sales Order Fulfilled and Channel Order Imported.
  • Orders you create by hand in SKU.io have no channel order. The workflow still runs for them, and you can branch on that, as shown below.

Turn it on​

  1. Open the workflow and double-click its trigger.

  2. On Parameters, turn on Include sales channel order.

    The Include sales channel order switch on a sales order trigger

  3. Under Test data, click the Load sample data from database icon. The trigger loads a recent order, with its channel order under channelPayload, and a link to that channel order so you can check it. This is what the builder offers in Insert field later.

The trigger's data now has a channelPayload block:

FieldWhat it holds
channelPayload.availableWhether a channel order was found. Channel Order Available? in Insert field.
channelPayload.unavailableReasonWhy not, when it wasn't: no channel order (created in SKU.io), the channel order is gone, or it was too large to include.
channelPayload.linesTruncatedWhether the order had more lines than are included.
channelPayload.integrationNameThe sales channel it came from.
channelPayload.channelOrderIdThe order number the channel shows, such as the Shopify order number.
channelPayload.orderThe whole channel order, as the channel sent it.
channelPayload.linesThe channel order's lines.

Pick a channel field​

Click Insert field in any box that accepts expressions. With the setting on, the list offers every field in the test order, grouped, including the ones only the channel sends. Pick one, or type the reference yourself:

{{ $json.channelPayload.order.tags }}

Shopify note attributes and metafields arrive as lists, and a given one isn't always in the same place in the list. Shopify orders also carry them by name, so you can read one directly:

To readUse
A metafield, by namespace and key{{ $json.channelPayload.order.metafield_values.custom.customer_type }}
A note attribute, by name{{ $json.channelPayload.order.custom_attribute_values.gift_message }}

Example: act only on wholesale Shopify orders​

  1. Add a Sales Order Created trigger and turn on Include sales channel order.
  2. Add an IF step. Set the condition to {{ $json.channelPayload.available }} is true, AND {{ $json.channelPayload.order.tags }} contains wholesale.
  3. Continue the True branch with what wholesale orders need, such as a Send Email to your account manager.

Checking available first keeps orders created in SKU.io, which have no channel order, on the False branch instead of failing the condition.

What's left out​

  • Sensitive values. Keys that look like passwords, tokens, API keys or card and bank account numbers are removed from the channel order before the workflow sees it.
  • Very large orders. The data is kept in the run history, so it's capped. An order with a very long list of lines includes only the first ones, and linesTruncated is true. An order too large to include at all has available false, and unavailableReason says it was too large.

Next steps​

Last verified: