Add minimum charge in Woocommerce cart page

// Paste below code in your active themes functions.php
add_action( 'woocommerce_cart_calculate_fees', 'wc_add_minimum_fee' );
function wc_add_minimum_fee(){
    global $woocommerce;
    $stotal = $woocommerce->cart->subtotal;
    if ($stotal < 999 ) { 
        $surcharge = 100;
    } else { 
        $surcharge = 0;
    }   
    $woocommerce->cart->add_fee( __('Surcharge', 'woocommerce'), $surcharge );
}

Comments

Popular posts from this blog

Stop video playing when Bootstrap modal is closed