Search code examples
javascriptarraysshopifyzapierzapier-cli

Zapier Cli - Is there a way to send line items from Shopify to my Zapier CLI App?


Just like this zap, how can i accept line items from Shopify app into my Zapier Cli app? What should be the inputFields and how should I map them to Shopify line items?


Solution

  • To set up your action to accept line items, you'll want to designate one of the inputFields in your action as the "line items" field. This field should have a children property with an array of line item fields (using the same field schema).

    For example, let's say your app has a "Create Invoice" action. The inputFields might look something like this:

    inputFields: [
        {key: 'customerAccountId', required: true, type: 'string'},
        {key: 'dueDate', required: true, type: 'datetime'},
        {key: 'line_items', children: [
            {key: 'item_name', type: 'string'},
            {key: 'price', type: 'number'},
            {key: 'quantity', type: 'number'}
        ]},
    ]
    

    More info in the field schema docs: https://zapier.github.io/zapier-platform-schema/build/schema.html#fieldschema

    This allows your action to accept line items from any app with a trigger that gives line items. The trigger description should say whether it has line item support—you can see a few examples from Shopify here: https://zapier.com/apps/shopify/integrations#triggers-and-actions