Hello @saqibrajpoot922,
I understand want to show the price with tax percentage before or after the price on the single product page.
In addition to what’s mentioned above, if you’re dealing with a fixed tax rate you can just use this hook woocommerce_single_product_summary
to add content before the product description.
Here’s a template you can work with, I added comments to explain what each part does:
add_action( 'woocommerce_single_product_summary', 'display_price_with_markup', 10 );
function display_price_with_markup() {
global $product;
// get_price() method returns a string so make sure to convert the value to an integer before doing calculations
$price = $product->get_price();
// Add a 10% markup or tax by multiplying the price with the .1 then echo it
$markup_price = floatval($price) + ($price * 0.1);
echo '<p class="price-with-markup">' . __('Price with 10% markup: ', 'woocommerce') . $markup_price . '</p>';
}
Link to image: https://d.pr/i/xvFntl
To learn more about WooCommerce single product page hooks, you can check this guide: https://www.businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/
Cheers!