Skip to content

E-commerce

Margin in e-commerce – how to calculate and increase it?

Read the articleQuestions and answers

Article cover: Margin in e-commerce – how to calculate and increase it?
Margin in e-commerce can be calculated correctly “on paper”, and yet the business still does not see cash, because the calculation is missing the right base and the full set of transaction costs. In practice, most mistakes come from confusing margin with markup and from looking only at gross margin, instead of margin after variable costs and net margin. This section shows you how to quickly tell whether you are calculating a percentage from the selling price or from the purchase cost, and how to read the results in the context of COGS, commissions and order cost. You will find here specific formulas and a numerical example that makes it easier to check reports and price lists. That way, it is easier to set minimum profitability thresholds and avoid sales that boost turnover but worsen the result.

How to avoid the most common mistakes between margin and markup?

You will most easily avoid mistakes if you remember that margin is calculated from the selling price, while markup is calculated from the purchase cost. Margin is the share of profit in the selling price, and markup is the share of profit in the cost, so with the same amounts you may see different percentages. For example: with a purchase at 80 zł and a sale at 100 zł, profit is 20 zł, but margin is 20/100 = 20%, and markup is 20/80 = 25%. In e-commerce, this distinction matters in practice, because it affects the assessment of SKU profitability and whether you are actually maintaining the assumed thresholds in the price list.

In practice, it is a good idea to stick to one calculation method throughout the analysis and clearly state whether the report shows margin or markup. Markup is especially useful when building price lists “from the purchase side”, because it more quickly shows whether, after a change in supplier cost, you will keep the planned retail price without the margin falling below the threshold. Margin, in turn, works better when comparing profitability in the context of price, because it relates profit to revenue. When teams (procurement, sales, performance) work with different definitions, the results quickly stop adding up.

  • Margin % = (Selling price – Cost) / Selling price × 100%.
  • Markup % = (Selling price – Cost) / Cost × 100%.
  • Check with an example: 80 zł → 100 zł gives a margin of 20% and a markup of 25% (this is not an error, just a different base).
E-commerce guide How to avoid the most common mistakes between margin and markup?
  1. 01Calculation baseMargin from the selling price, Markup from the purchase cost.
  2. 02Different percentagesThe same profit, different results (e.g. 20% vs. 25%).
  3. 03Impact on e-commerceAssessing SKU profitability, maintaining price thresholds.
  4. 04Consistent analysisConsistent calculation, clear labelling in reports.

Summary: Avoid mistakes by using one method and communicating it clearly in profitability analyses.

Why does gross margin not always show the full picture of profitability?

Gross margin does not give the full picture of profitability, because it shows only the relationship between revenue and COGS, while omitting order-dependent costs. It is calculated as (revenue – COGS) / revenue and answers the question “how much is left after deducting the cost of goods?”, which is why it can be a good starting point for comparing products. In an online store, gross margin alone does not include, among other things, marketplace commissions, payment costs and shipping, so it may look good even when each order contributes relatively little in reality. This is particularly important when selling through channels with different commissions and fees, where the same SKU may have different actual profitability.

WordPress media library file editing screen: image preview, alternative text field, caption and file details on the right
Example Alternative text is entered once for the file in the media library; next to it you can also see the image dimensions and file size, which affect page speed. WordPress (local CMS), own screenshot

In e-commerce, margin after variable costs (contribution margin) is usually more useful, because from revenue you deduct COGS as well as costs tied to a specific order (e.g. commissions, payments, packaging, shipping and ads attributed to the sale). This perspective gives a straightforward answer to whether each additional order genuinely helps cover fixed costs and generate profit. Only net/operating margin shows how much remains after all costs, including fixed ones (team, warehouse, software, accounting), and with a high CAC and a large number of returns it can be close to zero or negative. If a report “holds up” gross margin, but the financial result does not improve, that is a signal to switch to analysing margin after variable costs and after adjustments (discounts, delivery surcharges, returns).

How to calculate margin after variable costs in e-commerce?

You calculate margin after variable costs by subtracting from revenue not only COGS, but also all costs assigned to a specific order. In practice, variable costs include, among others, commissions (e.g. marketplace), online payment costs, packaging, shipping and advertising attributed to the sale. This margin directly answers the question of whether each additional order genuinely helps cover fixed costs and generate profit. To make the result reliable, assign costs at transaction level (order level), instead of calculating them “on average” for the whole store.

The most practical formula is: order contribution margin = Revenue – (COGS + commissions + payments + shipping + packaging + allocated ad spend). If on a £300 order you pay £180 COGS, £24 commission, £6 payments, £14 shipping and £20 advertising, that leaves £56 for fixed costs and profit. This kind of result in pounds often reveals faster what is “eating” profitability than the percentage on the product alone. It is precisely on this basis that it is easiest to set a minimum margin and make sure sales do not increase losses.

E-commerce finance How do you calculate margin after variable costs in e-commerce?
  1. 01RevenueTotal order value.
  2. 02COGSCost of goods sold.
  3. 03Commissions and paymentsMarketplace, payment gateways.
  4. 04LogisticsPackaging, shipping, materials.
  5. 05Allocated ad spendMarketing per order.

Key takeaway: contribution margin is revenue minus all variable costs assigned directly to a specific order.

What are the key differences between margin on an order and margin on a product?

The key difference is that product margin assesses the profitability of a single SKU, whereas order margin takes the entire basket into account, together with discounts and delivery costs. As a result, a customer may buy a low-margin product, but thanks to add-ons (cross-sell) the whole order achieves a high margin. It is analysis at order level that shows the real impact of elements such as discounts, basket “uplift” and shipping surcharges. That is why two orders with the same SKU can have different profitability if their baskets and fulfilment costs differ.

Product margin helps with assortment decisions, that is, assessing which SKUs are worth carrying at all, but on its own it is not enough to manage performance at the level of a single transaction. Order margin “captures” the impact of cross-sell, shipping costs and promotional mechanics that in practice spread costs across a higher revenue base. If you analyse only SKUs, you may conclude that a product “isn’t making money”, even though in reality it increases the profit of the whole basket. That is why, in reporting, it is best to maintain both views in parallel: product-based (SKU) and basket-based (order).

How do you optimise margin across different sales channels?

You optimise margin across different sales channels by calculating the profitability of the same SKU separately for the store, marketplace and, if applicable, B2B, because they differ in commissions, ad costs and return rates. The same SKU can have a different margin depending on the channel, which is why pricing and budget decisions should be based on margin broken down by channel, rather than on turnover alone. In practice, it comes down to asking whether you are selling on the marketplace “for volume or for profit”, and where you really keep the most after transaction costs. This comparison is most reliable when you assign costs to orders instead of averaging them at monthly level.

The most common margin “leaks” in channels result from marketplace commissions (on Allegro often around 6–15% depending on the category) and from whether the commission is charged on the product price or on the whole transaction including delivery. On top of that come online payment costs (usually around 1.3–2.3% + £0.20–£0.50), which for baskets of £50–£80 can reduce the result more through the fixed component than through the percentage alone. In channel analysis, also separate the actual delivery cost, the amount charged to the customer and the store top-up, because “free delivery from X zł” often means a real top-up on your side. If you run promotions or use marketplace promotional tools, treat them as a sales-dependent cost, because they can reshuffle the channel ranking in terms of profitability.

A practical way to keep control is to set a minimum margin and configure a “floor price” in price lists and pricing automation so you do not drop below the threshold at which sales start generating a loss. Where channel costs are higher (for example, due to commissions and advertising), differentiating prices by channel often works better than keeping one rate everywhere. Then the price on the marketplace can compensate for the higher fees, and the store can “defend itself” with other elements of the offer, without the need to keep giving away margin. To avoid the illusion of “good margin”, also monitor actual margin after adjustments, because discounts, delivery top-ups and returns can eat up several percentage points.

Margin strategy How do you optimise margin across different sales channels?
  1. 01Calculate profitability per channelCalculate margin for each channel separately.
  2. 02Different costs across channelsCommissions, ads and returns differ.
  3. 03Decide based on marginPriority: volume or profit?

Key: assign transaction costs directly to orders, do not average them.

How can you use LTV margin to increase customer profitability?

You can use LTV margin to increase customer profitability by assessing not only the first order, but the entire purchasing relationship over time. LTV margin is the sum of margins from successive purchases minus acquisition and servicing costs, so you can see when it is worth “subsidising” the first sale. This approach is particularly important when acquisition campaigns perform poorly in terms of a single transaction, but customers do in fact come back. In e-commerce it makes it easier to make decisions about ad budgets and customer retention mechanics based on profit rather than ROAS alone.

For LTV margin to be useful, split reports for new and returning customers, because new customers usually have a higher CAC, and the first order may have a low margin or generate a loss. Such a split answers the practical question of whether the model works thanks to retention, or solely thanks to continually “buying traffic”. Operationally, LTV margin also helps determine how much you can afford to pay at most to acquire an order in order to maintain the minimum margin across the customer lifecycle. If servicing costs rise with volume (e.g. more contacts to customer support), include them in the calculation, because only then does the result show the customer’s real profitability.

LTV margin grows when successive purchases cost you less to acquire and service, and basket margin improves thanks to product selection and purchasing mechanics. In your analysis, check what customers add on and what the margin is on the whole bundle, because often it is the basket, not the individual product, that determines the profitability of the relationship. If you implement loyalty programmes, treat them as a tool to reduce CAC and increase purchase frequency, not as automatic discount giveaways. At the same time, make sure that “retention” activities do not eat into the actual margin through overly large discounts, coupons or delivery subsidies, which can hide in reports outside the product’s core margin.

What pricing strategies can increase margin without raising prices?

You can increase margin without raising the price of the main product by designing promotions and offers so that margin grows across the whole basket, not just on a single SKU. Instead of a classic “-20%”, use bundling (sets) and conditional discounts such as “-15 zł from 250 zł”, which spread the cost of the promotion over higher revenue. As a result, the same customer leaves more in the basket, and you do not have to give away margin on the “magnet” product. The safest alternative to markdowns is combining the base product with a high-margin add-on, because then contribution margin rises despite no increase in unit price.

You can also improve margin without raising prices by consciously steering the basket, meaning upsell and cross-sell set up for profitability rather than for the “most popular” items. Instead of pumping random bestsellers, it is better to rely on recommendation rules such as “recommend accessories with margin >45%” and measure the effect in profit per session, not just clicks. Additional room comes from monetising services, because services attached to a product often have very high margin with low variable cost (time, process) relative to the price. If you sell a service (e.g. configuration or an extended warranty), you increase the margin on the order without having to change the product’s own price.

It is also worth using “threshold psychology” instead of changing list prices, for example by working with free delivery thresholds and observing AOV and the share of baskets “topped up” with extras. This approach limits delivery subsidies, because a larger basket usually makes it easier to “absorb” delivery cost in the margin. If you operate across multiple channels, separate pricing policy by channel, because commissions and acquisition costs differ between the shop and the marketplace, and one price everywhere does not always deliver the best margin. The key thing is to assess each of these strategies at order margin level (after variable costs), not only at product level.

How to monitor and manage margin using analytical tools?

You control margin most reliably when you report it at transaction level and maintain a consistent set of KPIs showing what is actually dragging performance down. In addition to gross margin, include metrics that “see” order-dependent costs and adjustments (e.g. returns), because these are what most often determine profitability. In practice, you set row = order, and in the columns you keep revenue, COGS, commissions, payments, shipping, advertising and a returns reserve, then you look at the distribution of results (median and quartiles), not just the average. A transaction report in Looker Studio or Power BI will catch the “tail” of unprofitable orders faster than averaged monthly summaries.

Matomo dashboard: chart of visits over recent months and tiles with visits, pageviews and visit duration
Example The visit overview combines the trend over time with basic engagement metrics — most traffic analyses start from this view. Public Matomo demo (sample data), own screenshot
  • Monitor: contribution margin, profit per order (zł), the share of marketing costs in revenue, net delivery cost for the shop and returns cost %.
  • Keep the sources consistent: orders from the shop platform + purchase costs from ERP + ad costs from Google/Meta + marketplace commissions, joined by order ID and date.
  • Set a marketing allocation model if you do not have ideal attribution (e.g. performance proportionally to revenue per channel, and product campaigns to categories), so that you do not “prop up” margin with a shared budget.

You manage margin more effectively when you add governance, i.e. alerts, tests and control of discount permissions, instead of assessing only “what happened” after the month has ended. Set notifications when price falls below the floor price or when costs (e.g. CPC or commissions) rise and contribution margin falls below a threshold, e.g. 15 zł per order, so you do not spend weeks pushing sales “in the red”. Run A/B tests of prices and promotions based on profit per session and profit per order, because higher conversion can come at the expense of lower margin. It is also worth introducing a clear discount policy and permissions (e.g. discounts >8% only after approval), because manual coupons and negotiations can undermine margin even when price lists remain unchanged.

Finally, close the process with data quality checks and scenario planning, so that decisions are not based on a “report error”. Regularly check whether COGS is up to date, whether delivery costs are not being averaged incorrectly and whether returns are being assigned to the correct orders, because otherwise the whole optimisation will be only an illusion. At the same time, prepare simple scenarios such as: +2 pp commission, +£1 per parcel, -5% price, +20% returns and calculate the impact on contribution margin and break-even point. With scenarios, you will quickly see what your margin is most sensitive to and which actions have the highest priority.

FAQ

Frequently asked questions

How do you distinguish margin from markup in e-commerce?

You calculate margin from the selling price, and markup from the purchase cost. With the same amounts, they therefore give different percentages, e.g. 20% margin and 25% markup.

Why does gross margin not show the full profitability of an online store?

Because it only considers the relationship between revenue and COGS and ignores order-dependent costs. In e-commerce, these can include commissions, payments, shipping and packaging.

How do you calculate margin after variable costs in e-commerce?

Subtract COGS and the costs assigned to a specific order, such as commissions, payments, shipping, packaging and advertising, from revenue. This result shows whether the order genuinely contributes to covering fixed costs and profit.

How does product margin differ from order margin?

Product margin assesses the profitability of a single SKU, while order margin takes into account the whole basket, discounts and delivery cost. That is why the same SKU can look different depending on the structure of the order.

How do you optimise margin across different sales channels?

You need to calculate the profitability of the same SKU separately for the store, marketplace and B2B, because channels differ in commissions, advertising and returns. This way, pricing decisions are based on real margin, not turnover alone.

How can you increase margin without raising the product price?

You can design promotions and offers so that the margin on the whole basket grows, for example through bundling, conditional discounts, upsell and cross-sell. Adding services to the product and differentiating pricing policy between channels also helps.

Contents