• Resolved Amaury

    (@amaurylopin)


    Hi,

    I’ve been looking for days now but i’m stuck.

    I’ve been doing some changes on my cart so product prices always end with psychological price (eg: usualy 11 products at 4.99€ makes it 54,89€ but I wanted it to make 59€).
    This works like a charm.
    Thing is, the subtotal counts the original price (54,89) but not the modified one.

    How can i get the subtotal to count the modified price ?

    Here’s the code i’ve been using

    function round_price_product( $price ){
        // Return rounded price
    $iprice = ceil($price);
    
        $mod_10 = $iprice % 10;
        $mod_5 = $iprice % 5;
    
        if ($mod_10 < 5) {
            return $iprice + 10 - $mod_5 - 11;
        }
        if ($mod_10 = 5) {
            return $iprice + 4;
        }
        if ($mod_10 > 4) {
            return $iprice + 10 - $mod_10 - 1;
        }
    
        return $iprice;
    }
    

    Thanks in advanced ??

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Woocommerce Subtotal Issue’ is closed to new replies.