How to Display Prices Including and Excluding Tax in WooCommerce

How to Display Prices Including and Excluding Tax in WooCommerce
On this page
  1. Why Show Both Tax-Inclusive and Tax-Exclusive Prices
  2. Step 1: Add the Dual-Price Suffix Filter
  3. Step 2: Style the Suffix to Match Your Theme
  4. Troubleshooting
  5. Frequently Asked Questions
  6. Conclusion

You can display prices including and excluding tax in WooCommerce by filtering woocommerce_get_price_suffix to append the alternate tax-inclusive or tax-exclusive price right next to the main price — showing both figures at once instead of just one.

Why Show Both Tax-Inclusive and Tax-Exclusive Prices

  • B2B stores often need to show the ex-tax price prominently while still disclosing the inc-tax total for compliance
  • Customers comparing your store to competitors sometimes need both figures to compare fairly
  • WooCommerce’s core settings only let you display one or the other, not both simultaneously
  • The built-in suffix option wraps text in a small HTML tag, making a second price awkwardly tiny by default

Step 1: Add the Dual-Price Suffix Filter

This assumes your store displays prices excluding tax by default (WooCommerce > Settings > Tax), and appends the tax-inclusive price as a suffix.

PHP
/** Show the tax-inclusive price next to the default ex-tax price */
add_filter( 'woocommerce_get_price_suffix', 'append_tax_inclusive_price_suffix', 20, 4 );

function append_tax_inclusive_price_suffix( $suffix, $product, $price, $qty ) {
    $inc_tax_price = wc_price( wc_get_price_including_tax( $product ) );
    $suffix = ' <span class="price-tax-note">(ex. tax) — ' . $inc_tax_price . ' (inc. tax)</span>';
    return $suffix;
}
Display prices including and excluding tax in WooCommerce: the page before adding the code
Before
Display prices including and excluding tax in WooCommerce: the page after adding the code
After

Reversing It for Stores That Display Inc-Tax by Default

PHP
/** Show the ex-tax price next to the default inc-tax price */
add_filter( 'woocommerce_get_price_suffix', 'append_tax_exclusive_price_suffix', 20, 4 );

function append_tax_exclusive_price_suffix( $suffix, $product, $price, $qty ) {
    $ex_tax_price = wc_price( wc_get_price_excluding_tax( $product ) );
    $suffix = ' <span class="price-tax-note">(inc. tax) — ' . $ex_tax_price . ' (ex. tax)</span>';
    return $suffix;
}

Step 2: Style the Suffix to Match Your Theme

Target the .price-tax-note class in your theme’s CSS to control font size and color — the goal is usually to keep it visible but visually secondary to the primary price.

Troubleshooting

Suffix Doesn’t Show on Variable Product Price Ranges

Variable products calculate their price-range display separately from the simple product suffix logic — pairing this filter with a variation-price-swap snippet (so a single active variation price is shown) makes the dual-tax suffix display correctly for variations too.

Wrong Tax Rate Applied for Some Customers

If you have location-based tax rates, wc_get_price_including_tax() calculates based on the store’s base location or the customer’s detected location depending on your tax settings — verify which one applies before assuming the displayed figure is wrong.

Frequently Asked Questions

Can I show both prices without any suffix wrapping in a small tag?

Yes — this custom filter approach avoids WooCommerce’s default suffix styling entirely, since you control the returned HTML directly rather than using the built-in suffix text field.

Does this work for products with multiple tax classes?

Yes — wc_get_price_including_tax() and wc_get_price_excluding_tax() both respect whatever tax class is assigned to the specific product being displayed.

Will this slow down the shop page with many products?

The added tax calculation runs per product price render, which is a lightweight operation — the performance impact is negligible even on catalogs with hundreds of products.

Conclusion

Displaying both tax-inclusive and tax-exclusive prices takes one filter on the price suffix, giving you full control over formatting instead of relying on WooCommerce’s default suffix text field. Pair it with a variation price-swap snippet if your store relies heavily on variable products. Getting this right is really what display prices including and excluding tax in woocommerce comes down to.

See also How to Display FREE Instead of $0.00 for WooCommerce Product Prices. Then read How to Display Was Now Save Pricing in WooCommerce.

Prefer no code? All-in-One Utilities Woo Add-on adds over 50 WooCommerce features, so you can switch them on without code.

Leave a Reply

Schedule a call