• Resolved miguel84

    (@miguel84)


    Hi all,

    Hi have variable products, and some variations the tax is 23% others is 6%

    On product page, on meta product details, I see that the SKU is updated everytime I choose a variation.

    Just after the SKU, I would like to add the tax rate of variation selected, and update it once you choose other variation, like it does for SKU

    I’m messing around with meta.php, I override it and inserted:

    $tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
    	if (!empty($tax_rates)) {
            $tax_rate = reset($tax_rates);
            echo ($tax_rate['rate']);
        }

    But I always get 23, that I assume is the rate of parent product, and I select variations that are 6% rate and this number does not update.

    Any idea how can I get this to work?

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Without having tested this, because taxing does not apply to my website, what does the code below give?

    https://github.com/woocommerce/woocommerce/blob/master/templates/single-product/meta.php#L33

    	//ADD THIS AFTER THE EXISTING CODE (LINE 33)
    	<?php if ( wc_tax_enabled() && ( $product->get_tax_class() || $product->is_type( 'variable' ) ) ) : ?>
    
    		<span class="tax_wrapper"><?php esc_html_e( 'TAX:', 'woocommerce' ); ?> <span class="tax"><?php echo ( $tax = $product->get_tax_class() ) ? $tax : esc_html__( 'N/A', 'woocommerce' ); ?></span></span>
    
    	<?php endif; ?>
    Thread Starter miguel84

    (@miguel84)

    Hi!

    Gives TAX: N/A and doesn’t change when selecting new variation

    /b2b/produto/lata-algarve-amarela-lt007/

    The option “Algarvio” is 6%, all others are 23%…

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @miguel84

    When using {price_including_tax} as the tax suffix under WooCommerce > Settings > Tax, changing between variation with different tax classes will change the product’s price on the product page. If this is not happening for your site then it’s likely a problem caused by something other than WooCommerce.

    Try updating WooCommerce and switching back to a default theme like Twenty Twenty, and disable all plugins except for WooCommerce to see if this resolves the issue. Here is a link that better outlines that process:

    https://docs.woocommerce.com/document/woocommerce-self-service-guide/#section-4

    If this fixes the issue, then re-enable each plugin one at a time, then the theme, until you find the one that’s causing the conflict.

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hello @miguel84

    We’ll mark this thread as resolved now that we haven’t heard back. Please feel free to open a new thread if you have any additional questions or concerns.

    Regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show tax rate on product meta’ is closed to new replies.