Title: Formula problem
Last modified: February 22, 2021

---

# Formula problem

 *  Resolved [wee2326](https://wordpress.org/support/users/wee2326/)
 * (@wee2326)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/)
 * Hello,
    I need to set the input weight to show the price Price=weight*8.5 But
   when the weight decimal point is less than 0.5, it is calculated as 0.5 Calculated
   as 1 when greater than 0.5 ex: 2.2KG=2.5*8.5 4.7KG=5*8.5 How to set up this formula?
 * Thanks in advance for any help.

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [DTECHNZ](https://wordpress.org/support/users/deardevils/)
 * (@deardevils)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14082264)
 * As far as I know, this plugin’s maths function can do round() and ceil().
    And
   the ceil is always round up to an integer. Round will round up or down to an 
   integer too. Round up to .5 I don’t think it is possible. Will wait for the answer
   from Author.
 *  Plugin Author [moomooagency](https://wordpress.org/support/users/moomooagency/)
 * (@moomooagency)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14082766)
 * [@deardevils](https://wordpress.org/support/users/deardevils/) One of the tricks
   would be doing like this: max(0.5,{var}). This way you get 0.5 when {var} is 
   less then 0.5, but you get {var} value is it is greater than 0.5.
 * [@wee2326](https://wordpress.org/support/users/wee2326/) Please, study this example.
   Maybe it is something you want.
 *  Thread Starter [wee2326](https://wordpress.org/support/users/wee2326/)
 * (@wee2326)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14083545)
 * Is this setting correct?
    The formula doesn’t work
 * [https://prnt.sc/103mkbg](https://prnt.sc/103mkbg)
 * [http://prnt.sc/103ml08](http://prnt.sc/103ml08)
 * Thanks.
 *  Plugin Author [moomooagency](https://wordpress.org/support/users/moomooagency/)
 * (@moomooagency)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14083607)
 * Why? What is the url of your product?
 *  [DTECHNZ](https://wordpress.org/support/users/deardevils/)
 * (@deardevils)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14087763)
 * [@moomooagency](https://wordpress.org/support/users/moomooagency/) the max(var1,
   var2,var3) is for picking the biggest number, what [@wee2326](https://wordpress.org/support/users/wee2326/)
   mean is he wants to pick the rounded up numbers, for example, 1.1kg ->1.5kg, 
   2.6kg->3kg.
 * It is not a standard js function, as round or ceil etc only change to integer.
 * So another tricky way for you [@wee2326](https://wordpress.org/support/users/wee2326/)
   make a matrix range instead.
    For example: real weight 0.01 0.50 0.51 1.00 1.01
   1.50 1.51 2.00 2.01 2.50 new weight 0.50 0.50 1.00 1.00 1.50 1.50 2.00 2.00 2.50
   2.50
 * People input real weight, then matrix generate newer rounded up weight.
    Then
   use the newer weight times the unit price.
 *  Thread Starter [wee2326](https://wordpress.org/support/users/wee2326/)
 * (@wee2326)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14087858)
 * Thanks for your reply! [@deardevils](https://wordpress.org/support/users/deardevils/)
   
   But this is used to calculate the weight of checked baggage So there is no weight
   limit…
 *  [DTECHNZ](https://wordpress.org/support/users/deardevils/)
 * (@deardevils)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14087870)
 * Then prob the easiest way is using ceil().
    Not accurate as you expected, but
   at least you won’t lose money on that, lol.
 *  Thread Starter [wee2326](https://wordpress.org/support/users/wee2326/)
 * (@wee2326)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14087906)
 * [@moomooagency](https://wordpress.org/support/users/moomooagency/)
 * [https://aus.voovs.net/shop/%E8%A8%97%E9%81%8B%E8%A1%8C%E6%9D%8E/](https://aus.voovs.net/shop/%E8%A8%97%E9%81%8B%E8%A1%8C%E6%9D%8E/)
 * thanks.
 *  [DTECHNZ](https://wordpress.org/support/users/deardevils/)
 * (@deardevils)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14087919)
 * [@wee2326](https://wordpress.org/support/users/wee2326/) in this case, you could
   use weight/0.5, then roundup.
    For example, 2.3/0.5 = 4.6 -> roundup to 5 Then
   5 x 0.5 again then times your unit price.
 * Easy as.
 *  Thread Starter [wee2326](https://wordpress.org/support/users/wee2326/)
 * (@wee2326)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14088007)
 * [@deardevils](https://wordpress.org/support/users/deardevils/)
 * Is it set like this?
    [https://prnt.sc/104ej1m](https://prnt.sc/104ej1m) [http://prnt.sc/104ejfr](http://prnt.sc/104ejfr)
 * I don’t know how to set it up
    Thanks.
 *  [DTECHNZ](https://wordpress.org/support/users/deardevils/)
 * (@deardevils)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14088014)
 * Let’s say your input field’s name is {uni_cop_weight}
 * create a NOV called {uni_cpo_nov_weight} = ceil({uni_cop_weight}/0.5)
 * In the main formula, use {uni_cpo_nov_weight}*0.5*8.5
 *  Thread Starter [wee2326](https://wordpress.org/support/users/wee2326/)
 * (@wee2326)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14088248)
 * [@deardevils](https://wordpress.org/support/users/deardevils/)
 * Thanks a lot for help!
    The price can be calculated correctly!! 🙂
 *  Plugin Author [moomooagency](https://wordpress.org/support/users/moomooagency/)
 * (@moomooagency)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14088370)
 * [@wee2326](https://wordpress.org/support/users/wee2326/) Can we close this topic?
 *  Thread Starter [wee2326](https://wordpress.org/support/users/wee2326/)
 * (@wee2326)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14088371)
 * [@moomooagency](https://wordpress.org/support/users/moomooagency/)
    YES, OK!

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Formula problem’ is closed to new replies.

 * ![](https://ps.w.org/uni-woo-custom-product-options/assets/icon-256x256.jpg?rev
   =1764217)
 * [Product Options and Price Calculation Formulas for WooCommerce – Uni CPO](https://wordpress.org/plugins/uni-woo-custom-product-options/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/uni-woo-custom-product-options/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/uni-woo-custom-product-options/)
 * [Active Topics](https://wordpress.org/support/plugin/uni-woo-custom-product-options/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/uni-woo-custom-product-options/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/uni-woo-custom-product-options/reviews/)

 * 14 replies
 * 3 participants
 * Last reply from: [wee2326](https://wordpress.org/support/users/wee2326/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/formula-problem-2/#post-14088371)
 * Status: resolved