I have next problem. I need to add text after price of the product and before short description. This text can be added in short description on first line like an option. The text that I want to add show the same price without 3% of itself.
I put this code in function.php of my current theme:
add_action('woocommerce_short_description','wire_price_3',11);
function wire_price_3()
{
$product = wc_get_product();
$product_price = $product->get_regular_price();
$percent_3 = ($price_p *3)/100;
$percet_price = $product_price - $percent_3;
echo "<h1>Wire price: {$percet_price}</h1>";
echo "n";
}
Eveythring works well but when I add this code my checkout page become a mess and show some code.
So, my question is how to find solution to this problem? BTW how can I make to show your text this text for example in green color.
Thank you.
2
Answers
i have changed your code, please try if it works properly
try this