Blog

Creating multi-price options

Posted by:

You are here:
< Back

There are different ways to create multi-price options, in this tutorial we are going to cover them

Changing price using conditional logic

If you just want to use different fixed prices depending on the options selected (you don’t need to do any arithmetical operation to calculate an option price) the best way to do this is by using conditional logic. To change the price with conditions do the following.

1.- Select a field and go to the condition tab

2.- Select the option “Change option price depending on a condition” and define a condition. For example, with the configuration below the conditional price will be used when the color of the product is ‘Black’

3.- Go to the field settings and define a price for each option

Changing price using formulas

Using condition is the quickest way to create dynamic prices when you know the price of each option in advance but if you want to do more advanced stuff, like doing arithmetical operations before calculating the price the best option would be to create formulas.

To create a formula to calculate a price do the following:

1.- (Optional) Define a price for each option. This is only needed if you want to do operations against the price of each option (for example if you want to multiply the price of the option by the value of another field)

2.- Select the “Formula” price type and define a formula, in the example below the formula will multiply the price of the option by a field called Weight. For more information about creating formulas check this tutorial

Using multiple values to calculate a price

Saving a value in each option might not be enough, for example, you might also want to save the weight of each option to do a different calculation somewhere else. To save additional values and do operations against them do the following:

1.- Select the field and click on ‘Add Additional Columns’

2.- Click on add column

3.- Define a column name and click on done

4.- Define a price for each item of the new column

5.- Select the “Formula” price type and add the field that has the custom column into your formula

6.- Add a dot next to the field, this will open a context menu with options for that field

7.- Select the option “GetColumnNumericalValue” and use the name of the custom column (in this example the custom column is called “Custom Column”)

8.- Do any operation that you want to do with that field, in the example below the field is multiplied by another field called Weight

Conclusion

You learned how easy is to calculate dynamic prices for your WooCommerce products. Using these options gives you a wide range of tools to calculate the prices in different ways. If you are a developer though there are even more options like using the API. These types of calculations will be covered in another tutorial.

0

About the Author:

Im programmer working for an international company. I have programmed since i was 12 and i have done it professionally for 6 years. Programming for a company is fun and i have learned a lot of things but i have always been interested in running my own business so i decided to give it a shot doing what i do best, programming stuffs.
  Related Posts
  • No related posts found.