Fees dependent upon subtotal in WooCommerce

1 replies
I am using WooCommerce and would like to add certain fees to the customer's final total depending on their subtotal.

For example, if their subtotal is:

Less than $8.99 | $7.99 fee
$9-$24.99 | x% fee
$25-$49.99 | y% fee
$50-$99.99 | z% fee

I have found documentation from the developer that adds a pre-determined % surcharge correctly, but I would like to have more precise structure.

Can anyone help me out?
#dependent #fees #subtotal #woocommerce #wordpress
  • This might help:

    function woocommerce_custom_surcharge(){
    global $woocommerce;
    //Getting Cart Contents.
    $cart = $woocommerce->cart->get_cart();
    //Calculating Quantity
    foreach($cart as $cart_val => $cid){
    $qty += $cid['quantity'];
    }
    //Your Condition
    if($qty==5)
    {
    $excost = 7;
    }
    else if($qty==7){
    $excost = 8;
    }

    $woocommerce->cart->add_fee('Charges delivery', $excost, $taxable = false, $tax_class = '');


    }
    {{ DiscussionBoard.errors[9248377].message }}

Trending Topics