• Resolved harveey

    (@harveey)


    I wanted to setup a WooCommerce tax on my website. however i need a condition where i will put the tax whenever the cart reach to a certain amount. for example i wont include tax if the price of the cart is around 500 usd. and i want to put at least 3% tax in example if the cart amount reach for 1k USD.

    Is there any ways to do this?

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Howdy @harveey ??

    Setting up tax with conditions as you described is not possible by default with the WooCommerce inbuilt tax settings. You may need a plugin to help you achieve this. Perhaps one of these will be of help.

    I’m not aware of a tax plugin that allows you set up tax with conditions as you described so I will be unable to make a solid recommendation, sorry.

    Hi @harveey,

    You can do that by adding a fee to the cart conditionally. Here is the code you can take reference from it.

    function zworthkey_add_fee_line( $cart ) {
       if (is_admin() && !defined('DOING_AJAX')) {
           return;
       }
      
       $percentage = 0.03;  // Percentage (3%) in float
       $percentage_fee = (WC()->cart->get_cart_contents_total() + WC()->cart->get_shipping_total() + WC()->cart->get_taxes_total()) * $percentage;
     
       $cart_total = (WC()->cart->get_cart_contents_total() + WC()->cart->get_shipping_total() + WC()->cart->get_taxes_total());
       if ($cart_total > 5000) {
       WC()->cart->add_fee(__('A small fee for orders over $5,000.00', 'txtdomain'), $percentage_fee);
     
    }
    add_action( 'woocommerce_cart_calculate_fees', 'zworthkey_add_fee_line' );

    I hope that work for you
    Thank you

    Thread Starter harveey

    (@harveey)

    Thanks for the replies.
    I found a plugin that adds a percentage to the subtotal whenever the amount reaches a certain amount.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Setting up WooCommerce Tax’ is closed to new replies.