I created a function for adding a fee to the Woocommerce cart. It works partially, but displays the lowest fee. It just ignores the condition of <= 550 and the highest fee. Does anyone have an idea how to fix this?
function verzendkosten( $cart_object ) {
global $woocommerce;
$laag = 37.50;
$hoog = 57.50;
$vala = 550.00;
$prijs = $woocommerce->cart->total;
if($prijs <= $vala) {
$woocommerce->cart->add_fee( 'Verzendkosten', $hoog, true, 'standard' );
}
if($prijs > $vala) {
$woocommerce->cart->add_fee( 'Verzendkosten', $laag, true, 'standard' );
}
}
add_action( 'woocommerce_cart_calculate_fees', 'verzendkosten' );