• Feature Request : This plugin would be amazing if the donate amount auto populated rounded up to the nearest dollar for the car total. So if the cart total, after tax was $23.56 then the amount to donate would be $.44

Viewing 1 replies (of 1 total)
  • You can add the code to the woo-donations.php file in the plugins/woo-donations folder.

    For add to cart, go to line 138, this is the on_cart_page.
    Line 139:
    global $woocommerce;
    Add below:
    $amount1 = floatval( preg_replace( ‘#[^\d.]#’, ”, $woocommerce->cart->get_cart_total() ) );
    $amount2 = ceil($amount1);
    $amount3 = $amount2-$amount1;

    Then line 155… find:
    class=”wdgk_donation” placeholder=”Ex. ‘.get_woocommerce_currency_symbol().’200″>
    Add after the 200″ value=”‘.$amount3.'”>

    so should be
    class=”wdgk_donation” placeholder=”Ex. ‘.get_woocommerce_currency_symbol().’200″ value=”‘.$amount3.'”>

    If will for example take a cart total of 10.50, round it up to next whole number (11) and then does round up subtract the cart total.. to give the round up difference for the donation.

    You can update the code on the other lines if using donations on checkout.

    Hope that helps

Viewing 1 replies (of 1 total)
  • The topic ‘Feature Request : Auto Round Up Cart’ is closed to new replies.