Using Pluck and Join to Extract Product Details in Workflows

Overview

The Pluck and Join workflow helpers enable you to extract specific product details from customer orders and combine them into a formatted string. This is particularly useful for automating tasks like order logging, updating external systems, or syncing data with platforms like Google Sheets.

How It Works

Pluck extracts values from an array of objects—such as product titles from an order—while Join combines those values into a single string using a separator you specify. Together, they help you process and format order data dynamically within workflows.

Step-by-Step Instructions

1. Set Up a Trigger

Begin by creating a workflow with a trigger that provides order data, such as Order Submitted or an Inbound Webhook. This ensures the workflow runs when a relevant event occurs.

2. Add a Workflow Action

Add an action where you want to use the extracted product details—for example, Create Row in Google Sheets. This action will use the formatted product data.

3. Use Pluck and Join Helpers

In the action’s fields, use the following syntax to extract and format product titles:

  • To extract product titles: {{ pluck order.line_items "title" }}
  • To combine them into a comma-separated string: {{ join (pluck order.line_items "title") ", " }}

You can replace title with other available fields like price, quantity, line_subtotal, line_discount, line_price, meta.product_id, price_id, or order_id.

4. Test the Workflow

Before activating, test the workflow with a sample order to verify that the product details are correctly extracted and formatted.

Example Use Case

To log order details in Google Sheets:

  1. Set the trigger to Order Submitted.
  2. Add a Create Row in Google Sheets action.
  3. Map the sheet columns:
    • Name: {{ contact.first_name }}
    • Email: {{ contact.email }}
    • Products: {{ join (pluck order.line_items "title") ", " }}
  4. Test with a real order to confirm the output matches expectations.

Available Fields

You can pluck any of these fields from order.line_items:

  • title
  • image
  • price
  • quantity
  • line_subtotal
  • line_discount
  • line_price
  • meta.product_id
  • price_id
  • order_id / invoice_id

By leveraging Pluck and Join, you can automate data extraction and formatting, reducing manual effort and improving workflow efficiency.