• Resolved Jimmy

    (@jayem82)


    Is it possible to round total cart discount to nearest integer? No decimals that is.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author algol.plus

    (@algolplus)

    hi

    Could you share the screenshot of the rule ?

    Thread Starter Jimmy

    (@jayem82)

    Plugin Author algol.plus

    (@algolplus)

    And you want to round coupon value “Mangdrabatt” ?

    Thread Starter Jimmy

    (@jayem82)

    That is correct : )

    Plugin Author algol.plus

    (@algolplus)

    please, try this code

    add_filter( 'woocommerce_coupon_custom_discounts_array', function( $couponDiscounts, $coupon ){
    $cents = pow(10, wc_get_price_decimals());
    foreach ($couponDiscounts as $key => $discount) {
    $couponDiscounts[$key] = round($discount/$cents) * $cents;
    }
    return $couponDiscounts;
    }, 100, 2);

    Thread Starter Jimmy

    (@jayem82)

    Thanks a bunch, it rounds up to nearest integer now!

    Want to praise you for making efforts to support even us free users. Since I have a very simple store and only need to use the plugin for bulk discounts and certain sale weekends, I have no use for the premium version. However, I would certainly pay otherwise!

    Five stars! Cheers

    Plugin Author algol.plus

    (@algolplus)

    You’re very welcome.

    we don’t differentiate between free/paid users actually, as this forum can be usefull for all users.

    Thread Starter Jimmy

    (@jayem82)

    Still, it is too much to ask for in my opinion ??

    Plugin Author algol.plus

    (@algolplus)

    ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Round cart total discount’ is closed to new replies.