wc_cart_round_discount

Round discount.

Description

(float) wc_cart_round_discount( (float) $value, (int) $precision ); 

Returns (float)

Parameters (2)

0. $value (float)
The value.
1. $precision (int)
The precision.

Usage

  1. if ( !function_exists( 'wc_cart_round_discount' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-cart-functions.php'; 
  3.  
  4. // The value. 
  5. $value = null; 
  6.  
  7. // The precision. 
  8. $precision = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wc_cart_round_discount($value, $precision); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-cart-functions.php  
  1. function wc_cart_round_discount( $value, $precision ) { 
  2. if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) { 
  3. return round( $value, $precision, WC_DISCOUNT_ROUNDING_MODE ); 
  4. } else { 
  5. return round( $value, $precision );