Digiverse

How to add a custom calculator to a Wix site

Short answer

For simple sums, a calculator app from the Wix App Market is the fastest route. For pricing with tiers, conditions or lead capture, build it with Velo: add input elements to the page, read their values in code, and update a text element with the result. Velo works in the Wix Editor and Wix Studio, not in Wix Harmony.

Three ways to add a calculator

OptionBest forLimits
Calculator app (e.g. Calculator Builder, Elfsight)Simple formulas, quick setup, no codeComplex logic, styling and lead handling can be limited
Embedded HTML calculatorA calculator you already have elsewhereSits in an iframe; harder to style and connect to your CMS
Custom Velo codeTiered pricing, conditions, saving leads, matching your designNeeds JavaScript; Wix Editor or Wix Studio only

Before you build: write the formula down

Most calculator problems are pricing problems. Before touching the editor, write your pricing as rules, then check them against three to five quotes you've actually sent. For example, for a cleaning company:

  • Base price: £60 for up to 2 bedrooms
  • Each extra bedroom: £15
  • Deep clean: price × 1.5
  • Minimum charge: £60

(These numbers are only an example. Use your own.)

Build it with Velo, step by step

1. Turn on Dev Mode

In the Wix Editor, turn on Dev Mode from the top menu. In Wix Studio, open the code panel. This shows the code editor and lets you set element IDs.

2. Add the inputs and a result

Add these elements to your page and set their IDs in the properties panel:

  • A text input or dropdown for bedrooms: #bedrooms
  • A checkbox for deep clean: #deepClean
  • A text element for the price: #price

3. Add the code

Paste this into the page code, then adjust the numbers to your pricing:

const BASE = 60;          // up to 2 bedrooms
const PER_EXTRA_ROOM = 15;
const DEEP_MULTIPLIER = 1.5;
const MINIMUM = 60;

function calculate() {
  const rooms = Number($w('#bedrooms').value) || 0;
  const extraRooms = Math.max(0, rooms - 2);
  let total = BASE + extraRooms * PER_EXTRA_ROOM;
  if ($w('#deepClean').checked) {
    total = total * DEEP_MULTIPLIER;
  }
  total = Math.max(MINIMUM, Math.round(total));
  $w('#price').text = `£${total}`;
  return total;
}

$w.onReady(function () {
  $w('#bedrooms').onChange(calculate);
  $w('#deepClean').onChange(calculate);
  calculate();
});

For a text input, you can use onInput instead of onChange so the price updates as the visitor types.

4. Test it on desktop and mobile

Preview the page and try the edge cases: zero, very large numbers, and every combination of options. Then check the mobile layout, where calculators most often break visually.

Making it a lead generator

A calculator that just shows a number is a nice feature. One that captures the visitor is a sales tool. Common upgrades:

  • Save each quote to a CMS collection with the inputs, result and date.
  • Ask for an email before showing the detailed breakdown, and send it as a branded summary.
  • Store prices in the CMS so you can change them from your dashboard without editing code.
  • Notify yourself by email or WhatsApp when someone requests a quote.

A note on Wix Harmony

Wix's newer Harmony editor doesn't support Velo site code (Wix Developers). On a Harmony site, use an app or an embedded calculator instead.

Want it built for you?

I build custom Wix calculators that match your pricing exactly, look native to your site and send every result to you as a lead.

Sources

Have a project in mind?

Tell me what you need. You'll get a reply with next steps, usually within a day.