• Resolved amarmustaqim

    (@amarmustaqim)


    Hi there,

    I want to have this rule in my website every RM10K of customer’s total cart, will have additional charge of RM5,000.

    For example
    RM10,000 to RM19,999 (the charge is RM5,000)
    RM20,000 to RM 29,999 (the charge is RM10,000)
    RM30,000 to RM 39,999 (the charge is RM15,000)

    Can you suggest how to set this rule?

    Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi, @amarmustaqim,

    You need to create the following rule for each fee https://snipboard.io/7bld30.jpg
    But we can’t manage the total cart, only subtotal.

    Thread Starter amarmustaqim

    (@amarmustaqim)

    Hi @missundaztood ,

    Thank you for your response, I have created the rule that you suggested. But if possible, I don’t want to create one by one for the rule, let say if my customer’s subtotal is RM 500K. That would be lot of work if I set it one by one based on 10K range.

    So I want to set any value that is more than 10K, will be charge 5K for each subtotal range of 10K. Is it possible to do like this? Or do I need to code it in functions.php?

    Thank you so much for your help.

    Plugin Author algol.plus

    (@algolplus)

    I’m sorry, our plugin can’t do it.

    Please, try this code

    add_action( "woocommerce_cart_calculate_fees", function() {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;
    
    $sum = WC()->cart->get_subtotal();
    if($sum <10000) 
        return;
    
    $fee = 5000*floor($sum/10000);
    if($fee)
        WC()->cart->add_fee( 'Processing Fee', $fee);
    });
    Thread Starter amarmustaqim

    (@amarmustaqim)

    Hi @algolplus ,

    Thank you so much for your help. It works well as expected!

    You’re welcome.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How To Add Extra Charge for Every Increment of 10K Total Cart’ is closed to new replies.