Help CenterFormula Pricing

Formula syntax reference

6 min read

Available variables

VariableDescriptionSource |----------|-------------|--------| costCost per itemShopify product.cost_per_item priceCurrent selling priceShopify variant.price compare_at_priceCurrent compare-at priceShopify variant.compare_at_price shipping_costCustom shipping cost (if set in metafield)Metafield: bulkops.shipping_cost packaging_costCustom packaging cost (if set in metafield)Metafield: bulkops.packaging_cost

Operators

OperatorDescriptionExample |----------|-------------|---------| +Additioncost + 5 -Subtractionprice - 10 *Multiplicationcost * 2.5 /Divisioncost / 0.6 %Moduloprice % 10

Functions

FunctionDescriptionExample |----------|-------------|---------| round(x, n)Round to n decimal placesround(cost * 2.5, 2) ceil(x)Round up to integerceil(cost * 2.5) floor(x)Round down to integerfloor(cost * 2.5) min(x, y)Minimum of two valuesmin(cost * 2, 99) max(x, y)Maximum of two valuesmax(cost * 2, 19.99) abs(x)Absolute valueabs(price - cost)

Conditional expressions

Use ternary syntax for conditions:

`` condition ? value_if_true : value_if_false `

Examples: ` cost < 20 ? cost * 4 : cost * 2.5 cost > 100 ? cost * 1.8 : cost * 2.2 `

Conditions support: <, >, <=, >=, ==, !=, &&, ||

Common formula patterns

Simple markup: ` cost * 2.5 `

Gross margin target (40%): ` cost / (1 - 0.40) `

Full cost stack with target margin: ` (cost + shipping_cost + packaging_cost) / (1 - 0.40) `

Tiered markup by cost range: ` cost < 10 ? cost * 4 : cost < 50 ? cost * 3 : cost * 2.2 `

Price floor — never price below $19.99: ` max(cost * 2.5, 19.99) `

Price cap — never price above $499: ` min(cost * 2.5, 499) `

Error messages

ErrorCauseFix |-------|-------|-----| Unknown variable: XTypo in variable nameUse cost, price, etc. Division by zeroFormula divides by zeroAdd a guard: cost > 0 ? cost / x : 0 Cost data missingProduct has no cost setAdd cost in Shopify admin Result is negative`Formula produces negative priceCheck your expression logic

Ready to try it?

Add BulkOps to your Shopify store — free plan available, no credit card required.

Add to Shopify — Free

Was this article helpful?