Custom Formula System
Create complex pricing calculations with JavaScript-based formulas. Reference fields, use conditionals, and build dynamic pricing for any scenario.
Overview
The Custom Formula System allows you to create sophisticated pricing calculations using JavaScript-like syntax. You can reference field values, product prices, quantities, and use conditional logic to build dynamic pricing for any business scenario.
Important Note
Custom formulas are only available in the Entrepreneur and Business plans. Upgrade to unlock this powerful feature.
Predefined Variables
The formula system provides several built-in variables you can use in your calculations:
The current calculated price (starts with product base price)
The product quantity from the cart
The original WooCommerce product base price
Reference any field's value by its unique ID
Referencing Fields
You can reference any field in your form using the syntax: {field.ELEMENT_ID.value}
Finding the Field ID
- Open your form in the form builder
- Click on the field you want to reference
- Look for the Element ID in the field settings
- Copy the ID (e.g., "field_123" or "size_option")
Mathematical Operators
Use standard JavaScript operators for calculations:
Example Formulas
Simple Addition
Adds $25 to the base product price
Quantity Discount
Apply 10% discount for bulk orders
Area Calculation
Calculate price based on area ($5 per sq unit)
Conditional Logic
Use ternary operators to apply different calculations based on conditions:
Conditional Examples
📦 Size-Based Pricing
Add $25 for large, $10 for other sizes
🎨 Color Premium
Add $50 for custom colors
🚚 Shipping Tiers
Free shipping >100, $15 for 50-100, $25 for <50
Real-World Examples
1. Custom T-Shirt Printing
Scenario: Base price $20, add $5 per color, $10 for large sizes, 10% discount for 10+ items
2. Custom Framing
Scenario: Calculate by area (width × height) at $2/sq inch, add $50 for premium frame
3. Cake Ordering System
Scenario: Base $30, add $5 per tier, $20 for custom design, 15% rush fee if needed within 48hrs
4. Cleaning Service
Scenario: $50 base + $25 per bedroom, $15 per bathroom, add $30 for deep clean
Advanced Techniques
Nested Conditionals
You can nest ternary operators for complex logic:
Mathematical Functions
Use JavaScript Math functions for advanced calculations:
Tips & Best Practices
✅ Do's
- ✓ Test formulas thoroughly before going live
- ✓ Use descriptive field IDs for easy reference
- ✓ Add comments in complex formulas
- ✓ Round prices for clean display
- ✓ Consider edge cases (zero, negative values)
❌ Don'ts
- ✗ Don't use undefined field IDs
- ✗ Don't forget to handle division by zero
- ✗ Don't make formulas too complex
- ✗ Don't forget parentheses for order of operations
- ✗ Don't skip testing with real data
Troubleshooting
Formula Not Working?
- Check that all field IDs exist and are spelled correctly
- Ensure field values are numbers when doing math operations
- Look for syntax errors (missing parentheses, quotes)
- Test with simple formulas first, then build complexity
- Check browser console for JavaScript errors
Price Shows NaN or Infinity?
- A field value might be empty or not a valid number
- You might be dividing by zero
- Check that referenced fields have default values
- Use parseInt() or parseFloat() to convert strings to numbers
Need Help with Complex Formulas?
Our support team can help you create custom pricing formulas for your specific use case.Contact us with your requirements.
Master Custom Formulas
Watch our video tutorial series on creating advanced pricing formulas
Watch Tutorial Videos