Finance · n8n

Stop Stacked Discounts From Pushing Shopify Orders Below Margin

A loyalty code, a sale, and free shipping can quietly combine into an order you lose money on. This workflow checks every order's true margin after all discounts and shipping, and flags — or holds — any order that dips below your floor before it ships.

difficulty Intermediatesetup 35 minresult No more surprise loss-making orders — every below-margin order is caught before fulfillment
  1. 1

    Trigger on every order

    A Shopify Trigger on orders/create inspects each order as it lands.

  2. 2

    Compute true margin

    A Code node subtracts COGS, all discounts and shipping cost from revenue to get the real margin percentage.

  3. 3

    Check against your floor

    An IF node flags any order whose margin falls below your minimum (e.g. 10%).

  4. 4

    Hold or alert

    A Shopify node tags the order 'margin-review' and a Slack message flags it before it fulfills.

  5. 5

    Learn from it

    Log flagged orders so you can spot which discount combinations keep causing losses and fix the codes.

Frequently asked questions

Will it delay legitimate orders?

It only flags orders below your floor — a tiny fraction. You can auto-approve above a small loss, or hold only true losses. Everything else fulfills normally.

Where does COGS come from?

From Shopify's cost-per-item field or a reference sheet. Even rough costs are enough to catch the orders that clearly lose money.

About this recipe. Recipes on FlowRecipesHub are written for business owners, not developers, and are tested before publishing — how recipes get made. Some ingredient links are affiliate links that cost you nothing — full disclosure.