Formula pricing: expressions, variables & rounding
A pricing formula is a short expression BulkOps.ai evaluates for every product to produce its new price. This guide covers what you can put in an expression while configuring a formula. For the exhaustive list of functions, see the Formula syntax reference.
Variables
Variables are lowercase and pull live data from each product:
| Variable | Meaning |
|---|---|
cost | Cost per item (Shopify) |
price | Current selling price |
compare_at_price | Current compare-at price |
shipping_cost, packaging_cost | Custom costs, if set via metafield |
Operators & expressions
- Arithmetic:
+-*/and parentheses for grouping. - Conditionals:
cost < 20 ? cost * 3 : cost * 2.2prices cheap and premium items on different rules.
| Goal | Expression |
|---|---|
| 2.5× markup | cost * 2.5 |
| True 45% margin | cost / (1 - 0.45) |
| Net margin incl. $4 ship & fees | (cost + 4) / (1 - 0.55) |
Rounding
After the expression runs, an optional rounding step tidies the result:
| Mode | Example ($42.13) |
|---|---|
| Charm — nearest $X.99 | $41.99 |
| Round up to nearest $1 | $43.00 |
| No rounding | $42.13 |
Always previewed. Whatever you write, BulkOps.ai shows the calculated old → new price and resulting margin for every product before you apply — and skips products missing a variable (like cost) rather than mis-pricing them.
Troubleshooting
Formula returns 0 or blank. Check variables are lowercase (cost, not Cost) and the product actually has that data.
Prices look too low. You likely used a markup where you meant a margin — see Gross margin vs. markup.
Ready to try it?
Add BulkOps.ai to your Shopify store — free plan available, no credit card required.
Add to Shopify — FreeWas this helpful?