AI automation for ecommerce: margin per order decides everything
An automation that costs more than the margin on the orders it touches is a loss. Where the margin actually goes, and which automations return more than they consume.
On this page
- What we'll cover
- What is actually left per order
- Where the margin disappears
- Which automations pay for themselves
- Building it with CodeWords
- Catalogue quality is the hidden lever
- Returns, priced properly
- Inventory and the two ways to lose
- Customer contact that pays
- Selling in more than one place
- Making it survive
- Limits worth knowing about
- What to build first
- Frequently asked questions
- Related reading
Ecommerce automation advice is usually written as though every order were equally worth automating. It is not. A store with thin margins on high volume needs different automation from one selling few expensive items, and the same workflow can be clearly worthwhile in one and a net cost in the other.
The number that settles it is contribution margin per order — what is actually 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, which is why automation decisions in this sector are so often made on instinct.
What we'll cover
- What is actually left per order
- Where the margin disappears
- Which automations pay for themselves
- Building it with CodeWords
- Catalogue quality is the hidden lever
- Returns, priced properly
- Inventory and the two ways to lose
- Customer contact that pays
- Selling in more than one place
- Making it survive
- Limits worth knowing about
- What to build first
- Frequently asked questions
What is actually left per order
Revenue is not the number, and neither is gross margin on the product alone.
Subtract the payment processing fee, which varies by method and by region and is not the rate you assume.
Subtract actual shipping, not charged shipping, and include the packaging.
Subtract the returns share for that product, which for some categories is 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, because the spread between your best and worst lines is usually far wider than anybody expects and it changes every decision downstream.
Where the margin disappears
Discounting that was not necessary, including automated recovery discounts to customers who were returning anyway.
Shipping charged below cost, which is a deliberate choice worth making deliberately rather than 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 against products that do not carry it, which happens whenever campaigns are managed by revenue rather than by margin.
Fees you have not looked at — payment, marketplace, platform — which drift and are rarely renegotiated.
Which automations pay for themselves
Anything preventing a failed delivery, since a second attempt costs more than most orders earn.
Anything preventing a support contact, which is why delivery expectations and clear product information are automation targets.
Anything preventing an oversell, because the cost is a refund, a contact and a lost customer.
Reorder signalling, which prevents both stockouts and overstock and is the highest-return signal most stores do not have.
Returns reason capture, which is cheap and feeds every other decision.
Not more marketing volume, which is the default answer and is frequently the one that adds cost to the orders it wins.
Building it with CodeWords
CodeWords connects to more than 3,000 integrations, and the connection is made once and reused.
- Open CodeWords and start a new automation.
- 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.
- Authorize the connections — the store platform, the shipping and returns systems, and the communication channel.
- Describe the exceptions: an out-of-stock item, a high-value order, a customer with an open ticket, an address that failed validation.
- Run it against last month's orders as a dry run and check what it would have done to each.
You describe the outcome; Cody builds it, connects it, and deploys it. The free plan covers light use, with Pro at $39 per month and Business at $100 per month as usage grows; details are on the pricing page.
Catalogue quality is the hidden lever
Wrong or thin product data causes returns, contacts and failed conversions simultaneously.
Sizing and dimensions are the highest-return fields to get right in apparel and furniture respectively.
Images per variant, since a customer who cannot see the colour they want either leaves or orders the wrong one.
Say what is in the box, which prevents a specific and common category of complaint.
Keep availability accurate, because an out-of-stock item that appears available converts into a refund rather than a sale.
Automate the audit, not the writing — missing fields, missing images, stale descriptions, unavailable products still listed.
Returns, priced properly
A return costs more than the refund: outbound shipping, return shipping, handling, inspection, and frequently a markdown.
Attribute it to the product, which turns a general returns rate into a product decision.
Categorise the reason in structured form, since "changed mind" and "not as described" are different problems and only one is yours.
A high not-as-described rate is a listing defect that is cheap to fix and expensive to leave.
Some products should not be sold at your return rate, which is a conclusion the data supports and instinct resists.
Make returning easy anyway, because difficulty produces chargebacks and reviews rather than retained revenue.
Inventory and the two ways to lose
Stockouts lose the sale and frequently the customer, who buys elsewhere and may not come back.
Overstock ties up cash and ends in markdown, which is a slower and equally real loss.
Lead time variability determines the buffer far more than the average does.
Automate the signal, not the order — units sold by variant over a window against a threshold, surfaced to somebody who decides.
Watch the slow movers, since cash sitting in unsold stock is the constraint most growing stores hit first.
Reconcile physical to system regularly, because counts drift and an oversell is the most expensive consequence.
Customer contact that pays
Delivery expectations, set accurately and updated when they change, which prevents the largest category of contacts.
Order problems, disclosed first, since a customer who finds out themselves costs more than one you told.
Review requests at the right moment, asked of everybody and without incentive, which is both the compliant approach and the effective one.
Reorder prompts for consumables, which is the highest-return repeat-purchase automation in the categories where it applies.
Not more campaigns to the same list, which increases unsubscribes and deliverability cost faster than revenue.
Cap total contact across every automation, since the customer experiences the sum.
Selling in more than one place
Multi-channel is where ecommerce automation stops being optional, because the number of places inventory can be sold from exceeds what anybody can reconcile by hand.
Inventory is the hard part. One pool sold from four channels oversells unless something reserves centrally and quickly.
Buffer per channel where sync latency is real, which costs some sales and prevents the more expensive failure.
Product data differs per channel, since each marketplace has its own required fields, taxonomy and image rules.
Pricing may need to differ, because fee structures differ and a price that works on your own store may lose money on a marketplace.
Order formats differ and normalising them into one shape is what makes fulfilment automation possible at all.
Marketplace rules constrain contact, and several prohibit messaging buyers outside their own channel — which invalidates several of the automations that work on your own store.
Making it survive
Make everything idempotent on the order, since webhooks retry and duplicate actions are costly.
Check current state before acting, because refunds, cancellations and address changes happen after the trigger.
Handle platform rate limits and outages by queuing rather than dropping.
Alert on zero orders for a period, since a broken integration looks exactly like a quiet day.
Report the outcome: orders processed, exceptions, contacts sent, and anything held.
Limits worth knowing about
Platform APIs constrain what can be read and how quickly, particularly around inventory.
Marketplace rules differ from your own store and frequently prohibit contacting buyers outside their channel.
Attribution is loose, so 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, and a high return rate caused by the product itself is not a workflow question.
What to build first
Contribution margin per product: revenue less product cost, payment fees, actual shipping, packaging, allocated returns and support contacts. It is a report rather than an automation, most stores do not have it, and it determines which of everything above is worth building for your catalogue rather than for a generic one.
Two habits make the difference. Attribute returns to the product that generated them, since a general returns rate hides the specific lines that are unprofitable at their actual return rate. And prefer automations that prevent a cost — a failed delivery, a support contact, an oversell — over automations that add marketing volume, because the preventions are certain and the volume is attributed generously.
Frequently asked questions
Why does margin per order determine what to automate?
Because 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 one need different automation, and the same workflow can be worthwhile in one and not the other.
What does contribution margin actually include?
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 per product, which is why automation decisions get made on instinct.
Which ecommerce automations reliably pay for themselves?
Anything preventing a failed delivery, a support contact or an oversell, plus reorder signalling and returns reason capture. The costs prevented are certain, whereas revenue attributed to marketing automation is generously counted.
Why is catalogue quality an automation target?
Because thin or wrong product data causes returns, support contacts and lost conversions simultaneously. Automate the audit — missing fields, missing variant images, unavailable products still listed — rather than the writing.
What does a return actually cost?
Outbound shipping, return shipping, handling, inspection and frequently a markdown, well beyond the refunded amount. Attributed to the product, it sometimes shows that a line is unprofitable at its actual return rate.
Should returns be made difficult to reduce them?
No. Difficulty produces chargebacks and poor reviews rather than retained revenue. Reduce the causes instead, which the structured return reasons identify.
What is the highest-return inventory automation?
The reorder signal — units sold by variant over a window against a threshold, surfaced to a person. It addresses both stockouts and overstock, and lead time variability rather than the average determines the buffer.
Does more marketing automation increase profit?
Not reliably. It increases volume and attributed revenue, and it also increases 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. One stock pool sold from four places oversells unless something reserves centrally and fast, and a per-channel buffer costs some sales to prevent the much more expensive failure.
Do marketplace orders support the same automations?
Not all of them. Several marketplaces prohibit contacting buyers outside their own channel, which invalidates review requests and post-purchase messaging that work fine on your own store.