Reputation: 83
I'm using WooCommerce, and also I'm using a free plugin, "Product Options and Price Calculation Formulas for WooCommerce – Uni CPO".
I'm having a little trouble there. My website sells a product using meter per square, so if my client want one meter I use this formula to calculate the price:
{uni_cpo_metrosquadrados2}x30.25
From here, everything is fine. Now my question is: My product has 1.778 meters per square per box. How is it possible to adjust (round up) the client meters to my box?
So, for example, imagine that the client wants one meter, but he needs to buy a box because a box has 1.778 meters, and he can't buy only one meter. I want to round up every time my client sets some value. Like, if he wants two meters, he needs to buy two boxes.
Upvotes: 0
Views: 271
Reputation: 83
Here is a solution:
(ceil(({uni_cpo_meters}/1.778))*your price
This will round up the number.
Upvotes: 1