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 margin | Price cut | Extra units needed to break even | Elasticity needed |
|---|---|---|---|
| 60% | 10% | +20% | -2.0 |
| 40% | 10% | +33% | -3.3 |
| 30% | 10% | +50% | -5.0 |
| 40% | 20% | +100% | -5.0 |
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 time | Effect on a naive estimate |
|---|---|
| Season or a general sales slump | Units fall after a price rise for reasons unrelated to price; elasticity looks too strong |
| Price cut timed to a slow period | Units rise as the season recovers; the cut takes the credit |
| Ad spend or an email campaign | Extra traffic is counted as price response |
| Stockouts | Zero-sales days after the change look like lost demand |
| Competitor price change | Your 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
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 before | 4 weeks after | Log change | |
|---|---|---|---|
| Product A price | $40.00 | $44.00 | +0.095 |
| Product A units | 220 | 180 | -0.201 |
| Control products, units | 1,500 | 1,410 | -0.062 |
| Product A units, net of controls | -0.139 |
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.
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
| Method | Data needed | Bias risk | Effort |
|---|---|---|---|
| Before and after | One product, two windows | High | Minutes |
| Difference in differences | One change plus similar unchanged products | Moderate | An hour |
| Log-log regression with week effects | A year of weekly data and several changes | Moderate, lower with clean reasons | A day to set up, then reusable |
| Planned price test | A deliberate change, timed away from promotions | Low | Weeks 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
- Bray, Stamatopoulos and Sanders, Observational price variation in scanner data does not reproduce experimental price elasticities, Kellogg School of Management working paper, 2024
- Bijmolt, Van Heerde and Pieters, New empirical generalizations on the determinants of price elasticity, Journal of Marketing Research, 2005
- Datma, Price Elasticity for Shopify: How to Measure the Revenue Impact of Price Changes (May 2026)
- QuantumLayers, Correlation vs Causation


