Catalog
Pricing

Pricing

TimberCloud offers two powerful ways to create product pricing: the Formula Builder for an intuitive step-based experience, and the Code Editor for advanced JavaScript-based formulas.


Formula Builder

TimberCloud Storefront — Product Catalog

The Formula Builder provides an intuitive step-based interface for creating pricing formulas without writing code. The same builder is used for pricing, parts, and inventory calculations.

Getting Started

  1. Navigate to your product's pricing section
  2. Click "Open Formula Builder" to launch the visual editor
  3. Build your formula step by step

Building Blocks

The Formula Builder supports five operand types:

TypeDescriptionExample
FieldReference line items or product optionswidth, material.price
NumberFixed numeric values144, 1.10, 50
MeasurementPre-built calculationsSquare Feet, Board Feet, Perimeter
GroupParentheses for order of operations(Base + Material) × Qty
ConditionalIf/then/else logicIF width > 48 THEN 50 ELSE 0

Available Measurements

MeasurementFormulaUse Case
Square Feet(W × H) ÷ 144Panel pricing
Board Feet(T × W × L) ÷ 144Lumber pricing
Linear FeetLength ÷ 12Trim, molding
Cubic Feet(W × H × D) ÷ 1728Large items
Perimeter2 × (W + H)Edge banding
Waste FactorQty × (1 + %)Material waste

Common Formula Templates

Quick-start templates include:

  • Price per Square Foot - Square Feet × Price
  • Price per Board Foot - Board Feet × Price
  • Base + Per-unit - Base Price + (Qty × Unit Price)
  • Size-based Upcharge - Conditional pricing for oversized items
  • Tiered Quantity Pricing - Different prices based on quantity

Example: Cabinet Door Pricing

Square Feet(width, height) × material.price
+ Perimeter(width, height) × edge.price
+ IF width > 48 THEN 50 ELSE 0

This formula:

  1. Calculates square feet and multiplies by material price
  2. Adds edge banding based on perimeter
  3. Adds a $50 upcharge for oversized doors

For complete Formula Builder documentation, see Formula Builder.


Code Editor (Advanced)

For complex pricing logic, use the JavaScript-based code editor.

The pricing editor has access to all your attributes and line items.

Selectable Items

Attributes

In this example we have an attribute called Material

NamePriceThicknessWeight
Cherry$253/40.8
Maple$303/40.5
Walnut$355/41.2

In our editor we can select Material → Price which adds:

material.price;

We can do this for any attribute or line item.

Line Items

Here's an example of what your line items table may look like during an order:

QTYWidthHeight
224 1/234 1/2
31224 3/4
114 1/23 3/4

Code Examples

Basic Example

// Base material price on Sq FT and add design and panel prices
((width * height) / 144) * material.price + (design.price + panel.price);

Custom Logic with Conditionals

// Set variables
const sqFt = (width * height) / 144;
const wood = material.price;
const design = design.price;
const edge = edge.price;
const panel = panel.price;
 
if (sqFt > 2) {
  // Nested logic for oversized items
  if (width > 48) {
    const upcharge = 50;
    return sqFt * wood + (design * (panelsH * panelsW) + edge + panel + upcharge);
  } else {
    return sqFt * wood + (design * (panelsH * panelsW) + edge + panel);
  }
} else {
  // Minimum 2 sq ft charge
  return 2 * wood + (design * (panelsH * panelsW) + edge + panel);
}

Tiered Pricing

const sqFt = (width * height) / 144;
const basePrice = material.price;
 
// Volume discount tiers
if (qty >= 100) {
  return sqFt * basePrice * 0.85; // 15% discount
} else if (qty >= 50) {
  return sqFt * basePrice * 0.90; // 10% discount
} else if (qty >= 25) {
  return sqFt * basePrice * 0.95; // 5% discount
} else {
  return sqFt * basePrice;
}

Best Practices

  1. Start with the Visual Builder - It's faster for most common formulas
  2. Use the Code Editor for complex nested logic
  3. Test with sample orders to verify calculations
  4. Document your formulas with comments in code mode
  5. Use meaningful attribute names for easier formula building

Troubleshooting

Formula Not Calculating

  • Ensure all referenced fields exist on your product
  • Check that attribute parts have values assigned
  • Verify line item field names match exactly

Unexpected Results

  • Check order of operations (use parentheses)
  • Verify measurement calculations use correct dimensions
  • Test with known values to validate formula

Visual Builder Tips

  • Use Groups to ensure correct calculation order
  • Measurement blocks automatically handle unit conversions
  • Conditionals can be nested for complex logic