stuartduff
6/3/2016 - 2:46 PM

WooCommerce Dynamic Pricing get rule amount which makes sure if you add a discount of 0.5% or similar that it calculates correctly.

WooCommerce Dynamic Pricing get rule amount which makes sure if you add a discount of 0.5% or similar that it calculates correctly.

function custom_woocommerce_dynamic_pricing_get_rule_amount( $amount ) {
    $a = floatval( $amount );
    if ( $a < 1 ) {
        $amount = $a / 100;
    }
    return $amount;
}
add_filter( 'woocommerce_dynamic_pricing_get_rule_amount', 'custom_woocommerce_dynamic_pricing_get_rule_amount', 10, 1 );