Create sales orders and line items from purchases
When a Shopify order is paid, its sales order and each item are created in your ERP or CRM, with a discount line when there is one, so fulfillment works from the same data.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/create-sales-orders-and-line-items-from-purchases/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Sales · Sales operations
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/create-sales-orders-and-line-items-from-purchases
Set it up with the CLI
- Add it. Copies the folder into
zaps/create-sales-orders-and-line-items-from-purchases/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/create-sales-orders-and-line-items-from-purchases - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy create-sales-orders-and-line-items-from-purchases - Check it. Its recent runs, with status and errors.
npx zap-pack logs create-sales-orders-and-line-items-from-purchases
zaps/create-sales-orders-and-line-items-from-purchases/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 2 to fill in
- connections/shopify.tsThe
shopifyaccount it uses - triggers/new-paid-order.tsWhat starts it:
shopifynew_paid_order_v3 - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a new paid order in Shopify (
shopify,new_paid_order_v3). The order ID is sent as the order's external ID, so the receiving system can match repeats. - Code step: the order's sales channel (
sourceName) becomes a readable customer label, such asOnline Store. - Webhooks by Zapier POSTs the order to your ERP or CRM Orders endpoint: order date, order number, customer label, customer email and phone, and the billing and shipping addresses.
- Webhooks by Zapier POSTs one sales-order line per purchased item: item ID, SKU, description, quantity, unit price and total price. Each line is its own step, so one failed line does not stop the others.
- If the order has a discount above zero, Webhooks by Zapier POSTs one extra line with the discount as a negative amount.
The Zap only creates records; it never changes or cancels an existing order.
Ask the user
Each REPLACE_… value is set per person. Resolve names to IDs with the user's own connections; don't ask them to paste an ID you can look up.
| Setting | What goes there |
|---|---|
ORDERS_WEBHOOK_URL |
The URL of the ERP or CRM endpoint that receives each new sales order. Anyone with this URL can create orders. |
ORDER_LINES_WEBHOOK_URL |
The URL of the ERP or CRM endpoint that receives each sales-order line, including the discount line. |
Also review the default with them: CUSTOMER_LABELS in workflow.ts maps Shopify sales channels (sourceName) to the customer label to send. Channels not listed are labelled Shopify (<sourceName>).
Also ask:
- Does the ERP match customers by email and create a new customer when none matches? This workflow sends the email and leaves matching to that system.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/create-sales-orders-and-line-items-from-purchases, replace each REPLACE_… value as this file says, then run npx zap-pack deploy create-sales-orders-and-line-items-from-purchases, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
shopifyto the user's Shopify connection for the store. The trigger uses it. Webhooks by Zapier needs no connection. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/new-paid-order.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyis the trigger'sevent, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect each action's fields with the user's connections (and sample the trigger, if it has one) before the first test run, and fix any key in
workflow.tsthat doesn't match.
Test it
Run this sample as a draft test run before publishing, against test endpoints only, with a test order from a Shopify development store:
{
"id": 820982911946154508,
"name": "#1001",
"email": "buyer@example.com",
"phone": null,
"createdAt": "2026-10-29T10:15:00Z",
"sourceName": "web",
"currencyCode": "USD",
"billingAddress": {
"name": "Test Buyer",
"address1": "1 Test Street",
"city": "New York",
"province": "NY",
"zip": "10001",
"country": "United States"
},
"shippingAddress": {
"name": "Test Buyer",
"address1": "1 Test Street",
"city": "New York",
"province": "NY",
"zip": "10001",
"country": "United States"
},
"lineItems": [
{
"id": 1,
"title": "Test shirt",
"sku": "TEST-SHIRT-M",
"quantity": 2,
"price": "20.00"
},
{
"id": 2,
"title": "Test cap",
"sku": "TEST-CAP",
"quantity": 1,
"price": "15.00"
}
],
"totalDiscountsSet": {
"shopMoney": { "amount": "5.00", "currencyCode": "USD" }
}
}
Check that the order endpoint received one sales order with external_id 820982911946154508, that the lines endpoint received two item lines (TEST-SHIRT-M at 2 × 20.00 and TEST-CAP at 1 × 15.00), and that one discount line of -5.00 followed. If run-status tools aren't available, check the result in the ERP or CRM directly. Ask the user to delete the test records there; the agent does not delete them.
Notes
- Amounts are sent as text with two decimals. Quantities are numbers.
- Line items are read from the order's
lineItems. If your Shopify app version names those fields differently, updateLineItemSchemaand the line mapping together. - Anyone with an endpoint URL can create records in that system. Keep the URLs out of shared copies of this file.
- Shopify's trigger returns an order's items only when the order has line-item support; the New Paid Order trigger used here has it.
- To route by storefront, add a lookup on
sourceNamebefore the order POST. To skip digital SKUs, leave their line items out, to reduce downstream tasks.