[ { "version": 1, "label": "Add new orders including all line items to a Google Sheets spreadsheet", "trigger_type": [ "order_paid" ], "object_type": "order", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": [ { "conditions": [], "actions": { "1": { "type": "google_sheets_v2", "settings": { "token_object_type": "order", "url": "[GOOGLE SHEET URL HERE]", "title": "Untitled spreadsheet", "settings": { "tab": "0", "update_mode": "update", "primary_key": "" }, "cells": { "0": { "weight": "1", "value": "{{ order.name}}" }, "1": { "weight": "2", "value": "{{ order.billing_address.first_name }} {{ order.billing_address.last_name }}" }, "2": { "weight": "3", "value": "{{ order.customer.orders_count }}" }, "3": { "weight": "4", "value": "{{ order.created_at}}" }, "4": { "weight": "5", "value": "{{ order.financial_status }}" }, "5": { "weight": "6", "value": "{{ order.fulfillment_status }}" }, "13": { "weight": "7", "value": "{% if order.fulfillments[0].created_at is defined %}\r\n {% for fulfillment in order.fulfillments %}\r\n {{ fulfillment.created_at }}\r\n {% endfor %}\r\n{% endif %}" }, "6": { "weight": "8", "value": "{{ order.total_quantity }}" }, "7": { "weight": "9", "value": "{{ order.note }}" }, "8": { "weight": "10", "value": "{% for key, line_item in order.line_items %}\r\n Line Item #{{ key + 1 }}\r\n{% endfor %}" }, "9": { "weight": "11", "value": "{% for line_item in order.line_items %}\r\n {{ line_item.title }}\r\n{% endfor %}" }, "10": { "weight": "12", "value": "{% for line_item in order.line_items %}\r\n {{ line_item.sku }}\r\n{% endfor %}" }, "11": { "weight": "13", "value": "{% for line_item in order.line_items %}\r\n {{ line_item.quantity }}\r\n{% endfor %}" }, "12": { "weight": "14", "value": "{# *** Remove this entire line to enable *** \r\n{% if order.financial_status == 'paid'%}\r\n {% for transaction in order.transactions %}\r\n {% if transaction.kind == 'sale' %}\r\n {{ transaction.created_at }}\r\n {% endif %}\r\n {% endfor %}\r\n{% endif %}\r\n*** Remove this entire line to enable *** #} " }, "14": { "weight": "15", "value": "{{ order.buyer_accepts_marketing ? \"yes\" : \"no\" }}" }, "15": { "weight": "16", "value": "{{ order.currency }}" }, "16": { "weight": "17", "value": "{{ order.subtotal_price }}" }, "17": { "weight": "18", "value": "{% set shipping_total = 0 %}\r\n{% for shipping_line in order.shipping_lines %}\r\n {% set shipping_total = shipping_total | plus(shipping_line.price) %}\r\n{% endfor %}\r\n{{ shipping_total }}" }, "18": { "weight": "19", "value": "{% set tax_total = 0 %}\r\n{% for tax_line in order.tax_lines %}\r\n {% set tax_total = tax_total | plus(tax_line.price) %}\r\n{% endfor %}\r\n{{ tax_total }}" }, "19": { "weight": "20", "value": "{{ order.total_price }}" }, "20": { "weight": "21", "value": "{% for discount_code in order.discount_codes %}\r\n {{ discount_code.code }}\r\n{% endfor %}" }, "21": { "weight": "22", "value": "{% set total_value = 0 %}\r\n{% for discount_application in order.discount_applications %}\r\n {% if discount_application.value_type == 'percentage' %}\r\n {% set amount = discount_application.value | divided_by(10) %}\r\n {% set total_value = total_value | plus(amount) %}\r\n {% endif %}\r\n{% endfor %}\r\n{{ total_value }}" }, "22": { "weight": "23", "value": "{% for shipping_line in order.shipping_lines %}\r\n {{ shipping_line.title }}\r\n{% endfor %}" }, "23": { "weight": "24", "value": "{{ order.created_at }}" }, "24": { "weight": "25", "value": "{% for key, value in line_item.properties %}\r\n {{ key }}: {{ value }}\r\n{% endfor %}" }, "25": { "weight": "26", "value": "{{ order.billing_address.display_name }}" }, "26": { "weight": "27", "value": "{% if order.tax_lines[0].title is defined %}\r\n {{ order.tax_lines[0].title }} {{ order.tax_lines[0].rate | times(100) }}%\r\n{% endif %}" } }, "wait": "0", "cw_timezone": "America\/La_Paz", "custom_wait": "" }, "weight": 1009, "target_key": "order" } } } ] }, "description": "This workflow will send all order details including line item data to Google sheets. The data includes quantities, customer data, tax information, discount amounts, etc." } ]