Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Shipping by Rules for VirtueMart

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Round to specified number of decimal digits 28 Nov 2014 02:34 #1

  • ruhanda
  • ruhanda's Avatar Topic Author
Hi all,

I need display result of calculation in Shipping name but the problem is number of decimal digits is to long such as 2.92933333333333. I want it display as rounded to be 2.93 or 2.9 depends on argument.

the current function of digit(val,n) is only return n-th.

Your help would be appreciated

Round to specified number of decimal digits 01 Dec 2014 17:11 #2

I think you are looking for the round(value, unit) function:
open-tools.net/documentation/shipping-by...emart.html#functions

E.g. round(variable, 0.01) should round to multiples of 0.01 (i.e. to two digits after the comma).

Best regards,
Reinhold

Round to specified number of decimal digits 03 Dec 2014 10:58 #3

  • ruhanda
  • ruhanda's Avatar Topic Author
Oh that's how to usage, due to I cannot find in documentation and example then I tried round(variable,2) and round(variable,-2) but no luck.
Now I got what I want.

Thanks

[SOLVED] Round to specified number of decimal digits 03 Dec 2014 12:45 #4

  • ruhanda
  • ruhanda's Avatar Topic Author
Problem solved.
  • Page:
  • 1