Merge branch 'pr/11497'

# Conflicts:
#	includes/wc-core-functions.php
This commit is contained in:
Mike Jolley 2016-07-22 12:55:34 +01:00
commit c9eef82550
3 changed files with 8 additions and 5 deletions

View File

@ -1367,15 +1367,16 @@ function wc_shipping_zone_method_order_uasort_comparison( $a, $b ) {
/**
* Get rounding precision.
* Get rounding precision for internal WC calculations.
* Will increase the precision of wc_get_price_decimals by 2 decimals, unless WC_ROUNDING_PRECISION is set to a higher number.
*
* @since 2.6.3
* @return int
*/
function wc_get_rounding_precision() {
if ( defined( 'WC_ROUNDING_PRECISION' ) ) {
return absint( WC_ROUNDING_PRECISION );
$precision = wc_get_price_decimals() + 2;
if ( absint( WC_ROUNDING_PRECISION ) > $precision ) {
$precision = absint( WC_ROUNDING_PRECISION );
}
return wc_get_price_decimals() + 2;
return $precision;
}

View File

@ -46,6 +46,7 @@ class WC_Tests_Main_Class extends WC_Unit_Test_Case {
$this->assertEquals( $this->wc->version, WC_VERSION );
$this->assertEquals( WC_VERSION, WOOCOMMERCE_VERSION );
$this->assertEquals( 4, WC_ROUNDING_PRECISION );
$this->assertContains( WC_TAX_ROUNDING_MODE, array( 2, 1 ) );
$this->assertEquals( '|', WC_DELIMITER );
$this->assertNotEquals( WC_LOG_DIR, '' );

View File

@ -181,6 +181,7 @@ final class WooCommerce {
$this->define( 'WC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
$this->define( 'WC_VERSION', $this->version );
$this->define( 'WOOCOMMERCE_VERSION', $this->version );
$this->define( 'WC_ROUNDING_PRECISION', 4 );
$this->define( 'WC_DISCOUNT_ROUNDING_MODE', 2 );
$this->define( 'WC_TAX_ROUNDING_MODE', 'yes' === get_option( 'woocommerce_prices_include_tax', 'no' ) ? 2 : 1 );
$this->define( 'WC_DELIMITER', '|' );