4️⃣How to create a formula that will work with options?

Product price calculator works correctly with options. It allows to add options on base of entered dimensions.

For example, you sell a table board, it has such options as a Top material (Oak, Birch, etc) and a Color (White, Black, etc.). Top material price depends on a price per a square meter. Color price is a fixed price that will be added to the final product price.

Let's see the formula example for this situation (initial price is per a square meter):

Once you have created the options for a product in the admin back-end, option values how they should be used in a formula appear in the Options section as it is shown on the screenshot above.

Formula explanation:

[val_1] is the value for the dimension Name with Position 1;

[val_2] is the value for the dimension Name with Position 2;

[opt_26] is the id value of the created Table top material option. Remember, in our example, this option has price modifiers that depend on a price per a square meter.

[opt_1] is the id value of the created Color option. Remember, in our example, this option has price modifiers that are fixed and should be added to the final product price.

[price] is the price per a square meter.

The formula looks as follows:

[val_1]*[val_2]*([opt_26]+[price])+[opt_1]

It means that Table top material option price [opt_26] is added to price per a square meter [price] then it is multiplied by the table area [val_1]*[val_2] and the Color option price [opt_1] is added to the final price.

Last updated