wc_get_rounding_precision

Get rounding precision for internal WC calculations.

Description

(int) wc_get_rounding_precision(); 

Will increase the precision of wc_get_price_decimals by 2 decimals, unless WC_ROUNDING_PRECISION is set to a higher number.

Returns (int)


Usage

  1. if ( !function_exists( 'wc_get_rounding_precision' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wc_get_rounding_precision(); 
  7.  

Defined (1)

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

/includes/wc-core-functions.php  
  1. function wc_get_rounding_precision() { 
  2. $precision = wc_get_price_decimals() + 2; 
  3. if ( absint( WC_ROUNDING_PRECISION ) > $precision ) { 
  4. $precision = absint( WC_ROUNDING_PRECISION ); 
  5. return $precision;