Price Elasticity From Your Own Price Changes: A Practical Method for Online Stores

Every price change you have made is a small pricing experiment, but a plain before-and-after comparison usually makes demand look more price sensitive than it is. Here is how to estimate price elasticity from your own order data with control products, a worked example, and when a price increase pays.

Most stores have changed prices dozens of times: a supplier raised costs, a product was repriced to match a competitor, a range was moved up a tier. Each of those changes is a small test of how customers respond to price, and together they can tell you a product’s price elasticity. The catch is that a simple before-and-after comparison is one of the least reliable ways to read them.

Academic work shows how far off that kind of estimate can be. A 2024 Kellogg working paper by Bray, Stamatopoulos and Sanders compared a large pricing experiment at a Midwestern grocery chain with estimates from ordinary price variation at the same chain. The average experimental elasticity was -0.34, while the average observational elasticity was -1.97. Prices that move for a reason, such as a sale timed to a slow week, make demand look far more sensitive than it really is. This guide shows how to get a more honest number from a WooCommerce or Magento store.

What price elasticity tells you

Price elasticity is the percentage change in units sold divided by the percentage change in price. An elasticity of -1.5 means a 10 percent price rise cuts units by about 15 percent. For reference, a meta-analysis by Bijmolt, Van Heerde and Pieters found that across 1,851 published elasticities from 81 studies, the average was -2.62 (Journal of Marketing Research, 2005). Treat that as a reminder of the range in the literature, not a target for your products.

Revenue is the wrong yardstick for a store with costs. What matters is whether a price change raises gross profit, and that depends on margin. For a price cut of d on a product with margin m (both as fractions of the current price), units must rise by d / (m – d) just to keep profit flat.

Gross marginPrice cutExtra units needed to break evenElasticity needed
60%10%+20%-2.0
40%10%+33%-3.3
30%10%+50%-5.0
40%20%+100%-5.0
Break-even unit lift for a price cut, before returns and shipping.

At a 40 percent margin, a 10 percent discount only pays if elasticity is stronger than -3.3. Very few products are that sensitive, which is why so many discounts lose money. Our post on how much of a Black Friday spike was real applies the same arithmetic to sales events.

Why before-and-after misleads

Datma, a Shopify analytics vendor, describes the before-and-after method in its guide to price elasticity and is candid about its weakness: it does not control for seasonality, marketing spend or inventory changes. Each of those moves sales on its own, and each tends to move at the same time as prices.

What moved at the same timeEffect on a naive estimate
Season or a general sales slumpUnits fall after a price rise for reasons unrelated to price; elasticity looks too strong
Price cut timed to a slow periodUnits rise as the season recovers; the cut takes the credit
Ad spend or an email campaignExtra traffic is counted as price response
StockoutsZero-sales days after the change look like lost demand
Competitor price changeYour relative price moved more, or less, than your own change

This is the general problem QuantumLayers covers in Correlation vs Causation: two series moving together is not evidence that one drives the other. The fix is a comparison group.

Step 1: rebuild your price history

Datma notes that Shopify keeps no log of past prices. WooCommerce and Magento are the same: the product record holds the current regular and sale price, nothing more. The order lines, however, record what each customer actually paid. In WooCommerce, the wc_order_product_lookup table holds quantity and net revenue per order line, so net revenue divided by quantity gives the realised unit price, by day or by week. That realised price is better than a list price anyway, because it includes coupons.

From now on, also log price changes as they happen: product, old price, new price, date, and why. The reason column is what lets you exclude the changes that would bias the estimate.

Step 2: choose which price changes to use

Deciding whether a past price change can be used to estimate elasticity Three questions in sequence. Was the change a reaction to that product’s own sales? If yes, exclude it. Did it overlap a promotion, campaign or stockout? If yes, exclude or shorten the window. Are there similar products whose price did not change? If yes, use a difference in differences estimate; if no, use it only with caution. Was it a reaction to this product’s own sales? Did it overlap a promotion, campaign or stockout? Are there similar products whose price did not change? Yes: exclude. Demand caused the price. Yes: exclude, or shorten the window Yes: difference in differences No: use with caution, wide error bars No No
Cost-driven and planned repricing are the best candidates. Markdowns on slow sellers are the worst.

The first question removes the main source of bias found in the Kellogg study. A markdown on a product that stopped selling, or a price rise on one that sold out, tells you about the product’s demand, not about the price. Price changes made for outside reasons, such as a supplier cost increase applied across a range, are close to a natural experiment.

Step 3: compare against control products

Pick products in the same category whose price did not change in the same period. Their sales movement captures season, traffic and everything else that hit the store. The difference between the changed product’s movement and the controls’ movement is the part you can attribute to price. This is a difference in differences estimate, and it works best on log scales so that percentages add up cleanly.

4 weeks before4 weeks afterLog change
Product A price$40.00$44.00+0.095
Product A units220180-0.201
Control products, units1,5001,410-0.062
Product A units, net of controls-0.139
Illustrative figures. Elasticity = log change in units divided by log change in price.

The naive estimate is -0.201 / 0.095 = -2.1, which would suggest the price rise was a mistake. Net of the controls, it is -0.139 / 0.095 = -1.46. Now check profit. With a unit cost of $24, margin per unit goes from $16 to $20. Adjusted for the store-wide dip, the expected units at the new price are 220 x e-0.139, about 191. Gross profit moves from 220 x $16 = $3,520 to 191 x $20 = $3,820. The price rise paid, even though units fell.

Difference in differences for a price change Weekly units for the repriced product and for the control products, indexed to 100 before the change. Both lines dip after the change date; the control products fall about 6 percent and the repriced product about 18 percent. The gap between the two drops is the effect attributed to price. price change 100 80 4 weeks before 4 weeks after control products (about -6%) repriced product (about -18%) effect of price
Without the grey line, the whole drop in the blue line would be blamed on the price change.

Step 4: pool many changes with a regression

One price change gives a noisy estimate. With a year of weekly data and several changes per category, a log-log regression with product and week effects does the same job across all of them at once. The coefficient on log price is the elasticity, and the week effects play the role of the control products.

import numpy as np
import pandas as pd
import statsmodels.formula.api as smf

# one row per product per week: units, avg_price (realised), on_promo, days_in_stock
df = pd.read_csv("weekly_product_sales.csv")
df = df[(df.days_in_stock == 7) & (df.units > 0)]

df["log_q"] = np.log(df.units)
df["log_p"] = np.log(df.avg_price)

model = smf.ols(
    "log_q ~ log_p + on_promo + C(product_id) + C(week)", data=df
).fit(cov_type="cluster", cov_kwds={"groups": df["product_id"]})

print(model.params["log_p"])          # elasticity
print(model.conf_int().loc["log_p"])  # 95% interval

Two notes on the code. Weeks with stockouts are dropped because censored sales distort the estimate; our post on estimating lost sales from stockouts explains why. Dropping weeks with zero sales is a simplification that is fine for steady sellers and poor for slow ones; for those, pool at category level instead. Always report the interval, not just the point estimate. An elasticity of -1.4 with an interval from -0.2 to -2.6 is not a basis for repricing.

Which method to use

MethodData neededBias riskEffort
Before and afterOne product, two windowsHighMinutes
Difference in differencesOne change plus similar unchanged productsModerateAn hour
Log-log regression with week effectsA year of weekly data and several changesModerate, lower with clean reasonsA day to set up, then reusable
Planned price testA deliberate change, timed away from promotionsLowWeeks of waiting

For the planned test, Datma recommends running a change for 2 to 4 weeks, avoiding sales events and holidays, and watching conversion rate rather than revenue alone. Showing different prices to different visitors at the same time raises fairness and legal questions in many markets, so a time-based test on the whole store, with control products alongside, is usually the safer design.

Sources