• Resolved nvdeals

    (@nvdeals)


    I’m encountering an issue with implementing price-based tax in WooCommerce. Specifically, I have a product with a tax rate of 12% if the product price is above 1000 rupees. However, if the product price is below 1000 rupees, the tax rate should be 5%.For example, if I list a product for 1200 rupees and apply a 12% tax rate, then a customer applies a 500 rupee coupon, bringing the final cart value to 700 rupees, the tax should be recalculated at 5%. However, it’s still calculating at 12%. How can I resolve this discrepancy?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @nvdeals,

    Thank you for reaching out to us with your query. I understand you are having an issue with inaccurate tax calculations for your products. From what you’ve described, it seems like you want the tax rate to adjust based on the final cart value after any discounts are applied. To achieve this, you’ll need to ensure that your tax settings are configured to calculate tax based on the cart subtotal after discounts. Here’s a step-by-step guide to check and configure your settings:

    1. Navigate to WooCommerce > Settings > Tax.
    2. In the Tax Options section, look for the setting that says ‘Calculate tax based on’.
    3. Make sure this is set to ‘Customer billing address’ or ‘Customer shipping address’ rather than ‘Shop base address’, as the tax should be based on the customer’s location after discounts are applied.
    4. Save your changes.

    Additionally, you’ll want to review your tax classes and rates to ensure they’re set up correctly for the different price thresholds. You can do this under WooCommerce > Settings > Tax > Standard rates. If you’re still encountering issues after checking these settings, could you please provide me with the following information:

    • The current tax settings you have configured.
    • Any tax-related plugins or custom code snippets you’re using.
    • A screenshot of the tax settings and the product setup in your WooCommerce dashboard (please ensure no sensitive information is displayed).

    This will help us understand your setup better and guide you more effectively.

    Thread Starter nvdeals

    (@nvdeals)

    I’ve already set up the customer’s shipping address, but I’m struggling with implementing price-based tax logic for products in the Indian clothing category. In India, there are two different GST tax rates for this category: 5% if the product price is less than 1000 rupees, and 12% if it’s above 1000 rupees.

    For instance, my product is priced at 1499 rupees, and when adding it to the store, I’m selecting the 12% tax option. However, I’m unsure how to ensure that if a user applies a discount coupon, the tax automatically adjusts from 12% to 5%. Can you guide me through the step-by-step process of implementing this logic?

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Thread Starter nvdeals

    (@nvdeals)

    This response doesn’t address my needs. I specifically require a breakdown of taxes for each product based on their individual prices, rather than a calculation of the total cart value.

    Thread Starter nvdeals

    (@nvdeals)

    have a look in this it works ??

    add_action( 'woocommerce_before_calculate_totals', 'apply_conditionally_gst_tax_rate', 10, 1 );
    
    function apply_conditionally_gst_tax_rate( $cart ) {
        if ( did_action( 'woocommerce_before_calculate_totals' ) >= 1000 )
            return;
    
        foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) {
            $product = $cart_item['data'];
            $price = $product->get_price();
            $tax_class = 'gst-5'; // Default tax class
    
            if ($price >= 1000) {
                $tax_class = 'gst-12'; // If price is greater than or equal to 1000, set tax class to gst-12
            }
    
            $product->set_tax_class($tax_class);
        }
    }
    
    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @nvdeals,

    I understand that you need the tax to vary per item depending on each item’s pricing. I’m glad to learn you’ve found a code snippet that does the trick for you, and I appreciate you sharing it here, as this may help other merchants with a similar request!

    I’m going to mark this as resolved now. Feel free to start a new thread if you have any more questions.

    All the best,
    Omar

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Price Based Tax Setup’ is closed to new replies.