1. Home
  2. Knowledge Base
  3. WooCommerce Product Options
  4. Price Formulas

Can I create multiple price formulas for the same product?

WooCommerce Product Options comes with a Price formula field which you can use to create custom price calculations. Customers sometimes ask us how to apply multiple price formulas to the same product. For example, you might want to do this in order to calculate the price in stages as the customer selects different options.

You can use multiple price formula fields for the same product - either by adding them to the same product options group, or across multiple groups. The result of each formula gets added to the total price for the product.

Front end display

On the product page, the user will not see that you have used multiple formulas. This is because the total for all of the formulas is added to the total price which appears above the add to cart button.

The cart page displays the cost for each formula. For example, the following screenshot shows both the cost for the raw material and for the customization, each of which depend on the other options:

Multiple price formulas in cart
\

Can I reference one price formula in another?

If your price formulas are in the same options group then you can reference them.

Here's an example to show you how it works: A store has a setup cost of $25 that they add to the single item price, which needs to be displayed as an itemized fee in the cart. Also, they waive the setup cost if the single item price is more than $250.

They can set up two price formulas to avoid repeating the same formula twice while also showing the two different results itemized in the cart:

  • Formula 1 - Calculated Price, which has the formula: [Material.value] * [width] * [height]
  • Formula 2 - Setup Cost, which has the formula: if ( [Calculate_Price] < 250, 25, 0 )

The second formula uses [Calculate_Price] to retrieve the result of the first formula.

It would look like this in the cart:

References between multiple price formulas

Tip: Avoid conflicts between your price formulas

Each price formula field has an 'Ignore product price' checkbox and price suffix settings. If you choose different settings for these in multiple formulas, then it could cause a conflict.

WooCommerce Product Options will handle any conflicts between these settings as follows:

  • For multiple formulas in the same group, the settings for the first formula will take precedence and they will be ignored for any other formulas.
  • For formulas across different groups, if at least one formula has the ignore price setting enabled, then the product price will be ignored across the same group and multiple groups. This means that the product price will only be added to the total if none of the formulas which apply to that product have the checkbox enabled.

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.