BlogResources

AI automation for ecommerce: margin per order decides everything

AI automation for ecommerce starts with contribution margin per order. See where margin goes and which automations pay off.

Amman VediAmman VediUpdated 11 min read

Summarize with AI

AI automation for ecommerce: margin per order decides everything
On this page

Contribution margin per order decides which ecommerce automations are worth building. A store with thin margins on high volume needs different automation from a store selling few expensive items, and the same workflow can pay off in one and cost money in the other.

Contribution margin is what is left after the product, the payment fee, the shipping, the packaging and the share of returns. Most operators do not have that number per product, so they decide on instinct.

What we'll cover

Key takeaways

  • Contribution margin per product, not revenue, tells you which ecommerce automations to build.
  • Automations that prevent a cost (a failed delivery, a support contact, an oversell) pay back with more certainty than automations that add marketing volume.
  • Returns cost more than the refund, so attribute each return to its product and capture a structured reason.
  • Selling in several places makes automation necessary, because inventory cannot be reconciled by hand across channels.
  • Build the contribution margin report first. It shows which other automations are worth building for your catalogue.

What is left per order

Contribution margin per order is revenue minus every cost that order triggers. Revenue alone is not the number, and neither is gross margin on the product alone. Work through these deductions:

Subtract the payment processing fee. The fee varies by payment method and by region, and it is rarely the rate you assume.

Subtract actual shipping, not charged shipping, and include the packaging.

Subtract the returns share for that product. For some categories, returns are the largest single deduction.

Subtract the support cost, allocated by contact rate, since some products generate contacts and some do not.

Compute it per product. The spread between your best and worst lines is usually far wider than expected, and it changes every decision downstream.

Where the margin disappears

Margin disappears in six places. Each one is a cost that automation can either prevent or make worse.

Unnecessary discounting, including automated recovery discounts sent to customers who would have bought anyway.

Shipping charged below cost. This is a valid choice, but make it deliberately instead of by default.

Returns on products that predictably generate them, particularly where sizing or description is the cause.

Support contacts that a better product page or a clearer delivery promise would have prevented.

Ad spend on products that cannot carry it. This happens when campaigns are managed by revenue instead of by margin.

Fees nobody has reviewed. Payment, marketplace and platform fees drift, and teams rarely renegotiate them.

Which automations pay for themselves

Automations that prevent a cost pay for themselves most reliably. Six categories qualify:

Failed-delivery prevention. A second delivery attempt costs more than most orders earn.

Support-contact prevention. Clear delivery expectations and product information are automation targets for this reason.

Oversell prevention. An oversell costs a refund, a support contact and a lost customer.

Reorder signalling. It prevents both stockouts and overstock, and most stores do not have it.

Returns reason capture. It is cheap and feeds every other decision.

Not more marketing volume. More volume is the default answer, and it frequently adds cost to the orders it wins.

Building it with CodeWords

CodeWords connects to more than 3,000 integrations (CodeWords pricing page, 2026), and you make each connection once and reuse it. To build an ecommerce automation:

  1. Open CodeWords and start a new automation.
  2. Describe what should happen in plain language to Cody, the automation builder: the trigger, what is checked, and what the customer or the team receives.
  3. Authorize the connections: the store platform, the shipping and returns systems, and the communication channel.
  4. Describe the exceptions: an out-of-stock item, a high-value order, a customer with an open ticket, an address that failed validation.
  5. Run it against last month's orders as a dry run and check what it would have done to each order.

You describe the outcome, and Cody builds it, connects it and deploys it. The Free plan costs $0, Pro costs $39 per month and Business costs $100 per month (CodeWords pricing page, 2026). Details are on the pricing page.

Catalogue quality is the hidden lever

Wrong or thin product data causes returns, support contacts and failed conversions at the same time. Fix these fields first:

Sizing and dimensions. These are the highest-return fields in apparel and furniture respectively.

Images per variant. A customer who cannot see the colour they want either leaves or orders the wrong one.

What is in the box. Stating it prevents a specific and common category of complaint.

Accurate availability. An out-of-stock item that appears available becomes a refund instead of a sale.

An automated audit, not automated writing. Check for missing fields, missing images, stale descriptions and unavailable products that are still listed.

Returns, priced properly

A return costs more than the refund. It adds outbound shipping, return shipping, handling, inspection and frequently a markdown.

Attribute each return to its product. This turns a general returns rate into a product decision.

Categorise the reason in structured form. "Changed mind" and "not as described" are different problems, and only the second is yours to fix.

Treat a high not-as-described rate as a listing defect. It is cheap to fix and expensive to leave.

Stop selling some products. At your return rate, a product may lose money. The data supports that conclusion even when instinct resists it.

Make returning easy anyway. A difficult return process produces chargebacks and bad reviews, not retained revenue.

Inventory: stockouts and overstock

Inventory can lose money in two ways, and automation should watch for both.

Stockouts lose the sale and frequently the customer, who buys elsewhere.

Overstock ties up cash and ends in markdown, which is a slower and equally real loss.

Lead time variability sets the buffer far more than the average lead time does.

Automate the signal, not the order. Compare units sold by variant over a window against a threshold, and send the result to a person who decides.

Watch the slow movers. Cash sitting in unsold stock is the constraint most growing stores hit first.

Reconcile physical counts to the system regularly. Counts drift, and an oversell is the most expensive consequence.

Customer contact that pays

Customer contact pays when it prevents a problem or prompts a repeat purchase. It costs money when it only adds volume.

Delivery expectations, set accurately and updated when they change, prevent the largest category of contacts.

Order problems, disclosed first. A customer who finds out alone costs more than a customer you told.

Review requests at the right moment, sent to everybody and without incentive. This is both the compliant approach and the effective one.

Reorder prompts for consumables. This is the highest-return repeat-purchase automation in the categories where it applies.

Not more campaigns to the same list. More campaigns raise unsubscribes and deliverability cost faster than they raise revenue.

Cap total contact across every automation, since the customer experiences the sum.

Selling in more than one place

Selling on several channels makes ecommerce automation necessary, because the number of places inventory can be sold from exceeds what anybody can reconcile by hand.

Inventory is the hard part. One stock pool sold from four channels oversells unless something reserves stock centrally and quickly.

Set a buffer per channel where sync latency is real. The buffer costs some sales and prevents the more expensive failure.

Product data differs per channel. Each marketplace has its own required fields, taxonomy and image rules.

Pricing can differ. Fee structures differ, and a price that works on your own store can lose money on a marketplace.

Order formats differ. Normalising them into one shape is what makes fulfilment automation possible.

Marketplace rules constrain contact. Some marketplaces restrict messaging buyers outside their own channel, which rules out several automations that work on your own store.

Making ecommerce automations reliable

Reliable ecommerce automation follows five practices.

Make every action idempotent on the order. Webhooks retry, and duplicate actions are costly.

Check current state before acting. Refunds, cancellations and address changes happen after the trigger.

Queue instead of dropping when a platform hits a rate limit or an outage.

Alert on zero orders for a set period. A broken integration looks exactly like a quiet day.

Report the outcome: orders processed, exceptions, contacts sent and anything held.

Limits worth knowing about

Ecommerce automation has five limits.

Platform APIs constrain what you can read and how quickly, particularly for inventory.

Marketplace rules differ from your own store, and some restrict contacting buyers outside their channel.

Attribution is loose. The revenue credited to any automation overstates its contribution.

Peak periods break assumptions, including carrier capacity and your own fulfilment throughput.

Automation does not fix a product problem. A high return rate caused by the product itself is not a workflow question.

What to build first

Build the contribution margin report per product first: revenue less product cost, payment fees, actual shipping, packaging, allocated returns and support contacts. It is a report, not an automation. Most stores do not have it, and it shows which of the automations above are worth building for your catalogue.

Two habits make the difference. First, attribute returns to the product that generated them, because a general returns rate hides the lines that are unprofitable at their actual return rate. Second, prefer automations that prevent a cost (a failed delivery, a support contact, an oversell) over automations that add marketing volume. Preventions are certain, while marketing volume is attributed generously.

Frequently asked questions

Why does margin per order determine what to automate?

An automation that costs more than the margin on the orders it touches is a loss. A thin-margin, high-volume store and a low-volume, high-value store need different automation, and the same workflow can be worthwhile in one and not in the other.

What does contribution margin include?

Contribution margin is revenue less product cost, payment processing fees, actual shipping and packaging, the returns share for that product, and allocated support cost. Most stores do not have this number per product, so they decide on instinct.

Which ecommerce automations pay for themselves?

Automations that prevent a failed delivery, a support contact or an oversell pay for themselves, as do reorder signalling and returns reason capture. The costs they prevent are certain, while revenue credited to marketing automation is counted generously.

Why is catalogue quality an automation target?

Thin or wrong product data causes returns, support contacts and lost conversions at the same time. Automate the audit of missing fields, missing variant images and unavailable products that are still listed, and leave the writing to people.

What does a return cost?

A return costs outbound shipping, return shipping, handling, inspection and frequently a markdown, which is well beyond the refunded amount. Attributed to the product, the total sometimes shows that a line is unprofitable at its actual return rate.

Should I make returns difficult to reduce them?

No. A difficult return process produces chargebacks and poor reviews, not retained revenue. Reduce the causes of returns instead, which structured return reasons identify.

What is the highest-return inventory automation?

The reorder signal is the highest-return inventory automation. It compares units sold by variant over a window against a threshold and sends the result to a person. It addresses both stockouts and overstock, and lead time variability sets the buffer.

Does more marketing automation increase profit?

No, not reliably. More marketing automation raises volume and attributed revenue, and it also raises unsubscribes and deliverability cost. Capping total contact across every automation matters more than adding another campaign.

What breaks first when selling on several channels?

Inventory breaks first. One stock pool sold from four places oversells unless something reserves stock centrally and fast. A per-channel buffer costs some sales but prevents the much more expensive failure.

Do marketplace orders support the same automations?

Not all of them. Some marketplaces restrict contacting buyers outside their own channel, which rules out review requests and post-purchase messaging that work on your own store. Check each marketplace's seller rules before you build.

Get started today

Your first workflow is free to build.

Describe what you need. Cody handles the build, the connections, and the deployment.