The definitive guide to formula-based pricing in WooCommerce

Searching for a way to allow customers to calculate the product price by formula in WooCommerce? In this guide, I'll walk you through the steps to create custom calculators with simple and complex formulas to calculate product prices directly on product detail pages in your WooCommerce store.

Setting the WooCommerce product price by formula means the store works the cost out from what the customer enters. Formula-based pricing is great for stores that sell products or services whose prices vary based on dimensions, weight, volume, or complexity. Think wallpaper, custom-sized curtains, butcher shops and cleaning services.

WooCommerce product page with a price formula calculating the cost from the dimensions entered

A WooCommerce product price by formula lets customers enter their own details and see an instant, tailored rate based on the options they choose. They save you from working out every customer's price by hand. They also show the shopper what a product costs before it reaches the cart.

There's no default way to set a WooCommerce product price by formula, so you'll need the help of a plugin.

In this detailed tutorial, we'll discuss the following:

  • The types of stores that can benefit from allowing customers to calculate the product price by formula in WooCommerce.
  • How to create simple and complex WooCommerce price formulas with the powerful Product Options plugin.
  • Winning strategies for building custom pricing formulas that generate more sales and improve the ordering experience.
  • How to test and troubleshoot errors with product price formulas in WooCommerce.

Do I need to price products by formula in WooCommerce?

Made to measure curtains product page pricing per square meter from entered dimensions

Most ecommerce stores set fixed prices for products - and that's how WooCommerce works out of the box. However, there are many situations where stores need to offer tailored pricing because their products or services vary based on specific customer measurements or selections.

Enter: Calculators with custom formulas to calculate product prices.

The calculator will adjust the final product price shown on the product detail and checkout pages based on each customer's input. This makes it super easy for customers to see the total price of the product without needing to request a quote or waiting for a reply.

Some types of store benefit from a custom price calculator more than others.

Stores that sell custom-sized products

The price of made-to-measure curtains, custom furniture and floor tiles depends on the exact dimensions each customer provides. Price calculators allow customers to input their measurements and get an instant price based on those details.

For example, a store that sells custom curtains might let the customer enter:

  • Width and height of the window.
  • Fabric type (linen, cotton or blackout).
  • Lining options.

Stores that sell products priced by weight

WooCommerce product priced by weight using a formula and a decimal quantity field

Weight-based pricing is common in stores that sell items like meat, seafood, produce, nuts, grains, candy, or bulk foods.

For example, a butcher shop might let customers choose:

  • The type of meat.
  • The quantity they want, i.e., product weight.
  • Extra services, such as the option to mince the meat.

Stores that sell products priced by weight can benefit from using a custom measurement price calculator to let customers select how much they want to buy and get an accurate price.

Stores that sell products priced by volume

Like with weight-based products, stores that sell liquids, gases, or other products by volume need a custom price calculator to offer accurate pricing.

Products sold by volume include paint, liquid detergent and beverages. Customers order in liters, gallons or cubic meters, so the final price varies a lot with the quantity and the quality.

For instance, a store selling paint might allow customers to:

  • Select the paint type (interior, exterior or specialty finishes).
  • Enter the product quantity, meaning the amount needed in liters or gallons.

The calculator will adjust the final product price based on the volume and type selected.

Stores that offer service-based pricing

Cleaning companies, landscapers and installation services price their work on several factors. Those usually include the size of the area, the time the work takes and how complex it is.

A custom price calculator allows customers to enter their details and get an instant estimate, rather than waiting for a manual quote.

For example, a cleaning service might use a price calculator that asks for:

  • Square footage of the area to be cleaned.
  • Type of cleaning service (basic, deep or move-out).
  • Number of rooms or additional services (window cleaning, carpet shampoo).

Introducing the best plugin to calculate the product price by formula in WooCommerce

WooCommerce Product Options plugin landing page with extra options and add-ons

WooCommerce Product Options is a plugin that lets you build calculators with custom price formulas. You can create calculators with both simple and advanced formulas that automatically adjust product prices based on customers' inputs.

It's perfect for WooCommerce stores that offer custom-sized products, products that are sold by weight or volume, services, and the like.

WooCommerce Product Options gives both store owners and customers more control and transparency when it comes to pricing. For example, you can choose to include the default base price in the final calculation or only calculate the product price based on customers' input values.

Here's a more detailed overview of its top features.

Flexible pricing formulas

Furniture product page with assembly and city options that adjust the price by formula

You can create dynamic price formulas that automatically calculate prices depending on the product's characteristics and various types of customer inputs.

This makes it ideal for a wide array of products and use cases. For example,

  • If you sell custom furniture, you can create a formula that adjusts the furniture price. This might be based on the width, height, material type chosen by the customer.
  • If you offer cleaning services, you could create a price calculator where customers enter the square footage of their home, the type of cleaning required, and the number of hours for the service.

Custom fields for extra options and product add-ons

Products that require custom price calculations are typically available in multiple variations and may include add-ons. For instance, let's say you sell custom t-shirts, you might want to allow customers to choose the size, color, and whether they want the add-on printing service.

WooCommerce Product Options lets you add many types of field to the product detail pages of items that have custom pricing formulas, including text areas, dropdowns, checkboxes and radio buttons. This enables customers to pick their desired variant and provide specific details to customize their order without contacting your support team.

Conditional logic

The Product Options plugin for WooCommerce includes conditional logic which lets you show or hide options based on what the customer selects.

Let's return to one of our earlier examples of a store that sells custom curtains. If a customer chooses between curtain materials, you can use conditional logic to show extra options for one material, such as finish type. Those options stay hidden for the other materials. The price then updates to match the materials, dimensions and options chosen.

Using conditional logic helps create a cleaner and more intuitive user experience (UX) and simplifies the price calculation.

Real-time price updates

One of the biggest benefits of setting up a custom calculator to calculate product prices by formula is that customers can see price changes in real-time as they select different options. This transparency helps customers feel confident about their orders, rather than abandoning their carts because the price is unclear.

For example, if you sell custom printed cards and a customer selects different paper sizes and finishes, they’ll immediately see how each option impacts the final price.

A real example: Replacement stove glass

Richard Fewings sells wood-burning stoves, flues and parts. He prices replacement stove glass by formula, because every stove takes a different size and most customers order by typing in their own dimensions.

Richard Fewings, who uses a WooCommerce price formula to price glass by the dimensions a customer enters

He came to the plugin from another platform. "We had a bit of custom code, but it was nowhere near as powerful," he says. "We were able to completely mirror the costs in there and then mark it up, all within the calculations."

His pricing spreadsheet works from staffing time, materials, packaging and a markup. The formula now reproduces that spreadsheet on the product page, and the price the customer sees is the price they pay rather than a quote.

He says the price formulas have directly improved his profit margins. "We know what our profit margin is on every different size of glass," he says. "Every conceivable size of glass, we've got a consistent profit margin, rather than some we're making a slight loss on and then some we're overpricing."

Richard uses custom variables to keep such a complex formula manageable and easy to read. "Instead of just having this one hugely long formula, you can bust out sections of the formula into its own variable," Richard says.

"The price of a box, the cost of the staff, the cost of the glue, the cost of the foam. When they change, we can just update that and the whole formula updates."

On the formula builder as a whole, he says: "I've not seen that in another plugin."

Richard isn't unusual. In our audit of sites running the plugin, 1 in 5 use a price formula.

Formulas instead of quote forms

Plenty of stores install request a quote plugins instead of offering custom pricing directly in WooCommerce. Most of them don't need to. When a quote request comes in, you work the price out in a spreadsheet from a handful of factors. Those same factors go into a price formula, and then the customer sees the price you would have quoted, at the moment they ask for it.

Richard's store is that argument in practice. The glass price is calculated, shown and charged without anyone at his end touching it.

However it's worth being aware that custom price formulas can get complex fast - just like spreadsheet formulas. Richard found the same: "It was a bit of trial and error to get the formulas to work, but they're pretty robust once you get them working."

That's why we built the price formula AI bot. Describe the pricing you need in plain English and it writes the formula for you.

Step-by-step guide to creating a custom pricing formula in WooCommerce

Building a calculator takes five steps, from creating the option group through to choosing how to display the result.

For this tutorial, I'll use the example of an ecommerce store that sells furnishings such as wallpaper, tapestries and rugs. I'll create a simple product price calculator with two fields: length and width, and a custom pricing formula for floral paper which is usually purchased in made-to-order sizes.

1: Name the price calculator and define visibility options

  1. Purchase the WooCommerce Product Options plugin, then follow the installation guide to add it to your site.
  2. From your site's admin panel, go to Product → Product Options, and click on "Add Group". This screen is where you can configure the settings for the price calculator.
    Product Options groups list with price calculator groups in WooCommerce
  3. The first order of business is to name this product price calculator. I've named it "Price Calculator" to keep things simple but if you plan to create multiple calculators, it's a good idea to use unique names to differentiate between them easily.
    Naming a price calculator group and setting its product visibility
  4. Tick the checkbox next to the "Display" field if you would like the group name to be displayed on the front end for customers to see. I recommend leaving this blank to avoid cluttering product detail pages.
  5. Next, you can define the visibility for the price calculator, i.e., which products this particular calculator will be applied to.
    • Choosing "Display globally on all products" will apply the calculator with the formula for all products in your store. You can still exclude items from specific product categories or specific products in the next step.
    • Choosing "Show on specific categories or products" will apply the calculator to select products in your store. You can still include and exclude specific products in the next step.

2: Add fields to the custom WooCommerce price calculator

  1. Scroll down to the "Options" section and click on "Add option". This is where you can add multiple product options to allow customers to choose from different product variations and add-ons. It's also where you can enter the details for the price calculator's fields and formula.
    Choosing the Number field type for a product price calculator option
  2. For this tutorial, I'm creating a simple product price calculator with two number fields: length and width. Let's begin to customize the first option. The first step is to name it and to keep things simple, I've named it "Length".
  3. You can tick the checkbox next to the "Display" field if you would like the option name to be displayed on the front end for customers to see. I recommend leaving this blank to avoid cluttering product detail pages.
  4. Next, I'll select the "Number field" option type as it'll let customers enter their own dimensions into the calculator. (Tip: If you want to use fields that aren't number fields as variables in the price formula - e.g. checkboxes or radio buttons - then that's fine. To do this, add the options as required, then click the blue cog icon to the top right of the list of choices. Add the Formula Value column and add the value that will be used in the price formula.)
  5. Find the "Choice" section. This is where you can enter the label for this field. Here, I've entered "Length (cm)". This will be visible on the front end.
    Setting the Length field label and description for the price calculator
  6. Select "No cost" from the "Price Type" dropdown list. The "Pricing" field next to it will be greyed out so you can't assign any values.
  7. If you like, you can also add a brief description to be shown next to this field on the price calculator. Here, I added "Choose a value between 50 and 1,000 cm".
  8. Important: Make sure you tick the checkbox next to the "Required" button as this field is mandatory to calculate the final product price accurately.
  9. Scroll down and click "Save changes".

3: Update advanced settings: default values, number types, number limits, etc

  1. Expand the "Advanced settings" clickable tray. First, enter the default value for this input field. Here, I've entered "100".
    Advanced field settings for default value and number limits in the calculator
  2. Choose the formats in which customers can enter the field values in the "Number type" field, i.e. whether whole numbers or decimals.
  3. Next, update the minimum and maximum number limits for which customers can specify the length of the wallpaper they want.
  4. Then scroll down and press "Save changes".
  5. Repeat the steps as many times as needed to create additional fields for the calculator. Here, I'll repeat them once as I'm adding 2 fields, i.e. length and width to the price calculator. Pro tip: A quick shortcut is to duplicate the product option and then modify the fields as required.

4: Add the custom price formula to the calculator

  1. Once you've added all the product options and user input fields, it's time to add the formula that will calculate their values. To do so, select "Add option" from the same "Options" section.
  2. Enter the name for the option. Here, I've entered "Price formula".
    Selecting the Price formula field type for a WooCommerce product
  3. Select "Price formula" from the "Option type" field to enable price calculation.
  4. Next, enter the mathematical formula that will calculate the final price of the product.
    Entering the mathematical formula that calculates the final product price

    Pro tip: Use the buttons underneath the input field area to add the mathematical operators. Here, I've entered [Width] + [Length] * [product_price].

  5. Enter the suffix to be shown next to the price on the product page. You can add any text here, for example, the measurement dimension (cm or square meters) or a brief description of how the price is calculated.
  6. Enable the "Ignore main product price" option if you want to prevent the product price from being included in the final product price calculation.
  7. Scroll down and press "Save changes".

Here's how the finished calculator looks on the front end:

Front end of a WooCommerce price formula showing the calculated product price

5: Choose how the result is displayed

By default, the result of the formula is added to the product price. The advanced display settings give you more control over what the customer sees.

  1. Open the price formula option and turn on the "Advanced settings" toggle.
  2. Tick "Display as a separate line before Totals" to show the result on its own line above the total. The line is labeled with the option name and updates as the customer changes their measurements.
  3. Untick "Add result to product price" if you want to calculate a value without charging for it.
  4. Choose a "Unit" for that value. Use your store's weight or dimension unit, or enter your own, such as "hours" or "m²".
  5. Use the checkboxes under "Cart, checkout and order page" to control where the result appears once the product is in the cart.
Price formula advanced display settings in WooCommerce Product Options

Made-to-measure stores often put two formulas on one product. The first works out the area and shows it on its own line without charging for it. The second charges for that area. As a result, the customer sees how much fabric their order needs as well as what it costs.

For the full list of options, read our guide to the price formula display settings.

Quick guide: How to test the formula is working

Even the smallest errors in pricing can hurt sales and damage customers' trust in your business.

Here are some ways to put your custom formulas for calculating the product price by formula in WooCommerce to the test.

Manual testing

Manual tests are exactly what they sound like - entering different input values directly into the calculator one by one. You’ll want to cover a variety of cases:

  • Normal inputs: Start with typical values customers would enter. For example, if you're selling custom-sized products like curtains, try entering common window sizes to make sure the price calculates correctly.
  • Edge cases: Next, enter the minimum and maximum values for each input field to ensure the formula handles them appropriately. For instance, test what happens when someone orders the smallest possible size or the largest. Does the calculator still work, and does it give the right price?
  • Invalid values: Try entering a negative number or leaving a required field blank, then check how the calculator responds.

Automated testing tools

Tools such as Selenium, PHPUnit, Cypress can simulate different customer inputs for a wide range of variables and compare the results against the expected prices. For example, you can set up automated tests to check:

  • Different combinations of product options (like material, size, or quantity).
  • Extreme values (e.g., the highest and lowest possible inputs).
  • Random values to see if there are any cases where the calculator fails.

Using automated testing tools enables you to evaluate hundreds of scenarios across different combinations of these values quickly. If the tool finds any discrepancies, it will flag them so you can fix the issues before they affect real customers.

Troubleshooting WooCommerce pricing formulas

You'll usually trace a wrong price back to taxes, rounding, conditional logic or currency conversion.

Incorrect application of taxes

One of the most common issues is miscalculating taxes. This can happen when your pricing formula doesn’t properly account for tax rules based on location, product type, or customer type.

How to solve it:

  • Triple-check your WooCommerce tax settings. Go to WooCommerce → Settings→ Tax and make sure you've set up the correct tax rates for different locations and product types.
  • Integrate taxes into your formula. If your prices are exclusive of tax, ensure the calculator applies the correct tax rate based on the customer’s location. WooCommerce can handle this if your settings are correct, but you’ll need to make sure the formula doesn’t interfere with this calculation.

Data entry errors

Human error is pretty common when setting up custom formulas. If you’ve entered incorrect product attributes, dimensions, or rates into your calculator, the pricing will inevitably be wrong.

How to solve it:

  • Verify the product data. Make sure that the product data you entered, e.g. heights, weights and dimensions, is accurate and up to date.
  • Test the inputs thoroughly. After setting up your calculator, run multiple tests using different product configurations (feel free to use any of the methods we discussed earlier!). This will help you spot any data entry errors early.

Logical errors in formulas

Logical errors can happen when the formula isn’t set up correctly. This can lead to inaccurate or unexpected prices. For instance, the formula might multiply when it should add, or miss a step in the calculation process.

How to solve it:

  • Break the formula down into steps. Instead of creating one long formula, break it into smaller parts that are easier to manage. Then test each step independently before combining them. This way, if something goes wrong, you can isolate the issue more easily.

Debugging tools

If you've run manual and automated tests and something still isn't working, try the debugging tools. They show the exact path the calculation takes, which helps you find what went wrong.

Debugging tools are especially useful if the error is hard to reproduce or only happens with specific input combinations. So, for example, if customers get incorrect prices only with a particular combination of inputs, debugging can help you trace the inputs to pinpoint exactly what led to the wrong output.

When your formula depends on customer measurements

If the inputs feeding your formula are a width, an area, a weight or a volume, the formula itself is only half the job. You also need to decide which fields and units make sense for what you sell, and where rounding or minimum order sizes come into play.

For that side of the setup, see the guide to WooCommerce measurement price calculators, which covers the field types and unit choices that suit dimension-based and weight-based products specifically. Use it alongside this guide: that one helps you plan the inputs, this one helps you turn them into a price.

Strategies for building your custom pricing formula

Here, I'll show you four powerful approaches to help you design a price formula that boosts sales in your WooCommerce store: dynamic pricing, tiered pricing, volume discounts, and psychological pricing.

Dynamic pricing

With dynamic pricing, you adjust prices based on product variables like quantity, size, or specific attributes to ensure that customers pay based on what they need.

To create a dynamic price formula, consider all the attributes that influence the price of production. Then factor them into the final cost. This way, you can easily cover your costs and still offer customers a fair deal.

For example, if you sell custom furniture, your dynamic pricing formula could adjust the price based on the size of the item, the type of wood, and any additional finishes or features. So naturally, a larger table or one made with premium wood like walnut would cost more than a smaller, simpler one with engineered wood.

Tiered pricing

Tiered pricing sets different price levels based on the quantity purchased and rewards customers who buy in larger quantities. The principal idea is that the more a customer buys, the cheaper each individual unit becomes.

Tiered pricing encourages bulk purchases and increases your overall order value.

For example, if you run a t-shirt printing business, you can create a price formula with clear breakpoints where the price drops at certain quantities. Like this:

  • 1-10 shirts: $20 each.
  • 11-50 shirts: $18 each.
  • 51-100 shirts: $15 each.

Volume discounts

Similar to tiered pricing, offering volume discounts is another way to encourage customers to purchase products in bulk quantities. However, unlike tiered pricing which offers different price levels based on quantity ranges, volume discounts apply a percentage or flat-rate discount to orders that meet a certain quantity threshold.

For example, a store that sells curtains can offer a 10% discount on orders over 500 meters.

When offering volume discounts, confirm that your formula factors in all costs to make sure the discounts don’t eat into your profit margins too much.

Psychological pricing

Psychological pricing means setting a price just below a round number, for example $9.99 instead of $10.00. It's one of the oldest conventions in retail.

Rounding final prices down can make your products seem more affordable and appealing to customers. This can go a long way towards increasing conversions without taking a big bite out of your profits.

Ready to enable shoppers to calculate the product price by formula in WooCommerce?

Custom price calculators are a must for ecommerce stores that sell products for which standard pricing doesn't apply. They allow online shoppers to swiftly calculate the product price by formula in WooCommerce.

Out of the box, WooCommerce doesn't include the option to build calculators with custom price formulas. But you can set it up using a plugin.

WooCommerce Product Options is a powerful plugin that lets you create custom calculators with simple and complex formulas that automatically adjust product prices depending on customers' inputs.

With it, you can create dynamic formulas with mathematical and logical operators to calculate prices for various types of products, such as custom-sized products, products sold by volume or weight, and services.

Plus, you can add dropdowns, checkboxes, radio buttons and text areas to offer add-ons and multiple variations of the same product. And it comes with additional useful features like conditional logic, minimum and maximum values, default values, and others.

Get WooCommerce Product Options and allow shoppers to calculate the product price by formula in WooCommerce today!

Please share your thoughts...

Your email address will not be published. Required fields are marked *