I have one little problem that I can't solve yet. I have this WooCommerce web site with variable products, and currently prices are shown in this way:
$5.50 per dozen – $100.00 per dozen
I use this CSS rule that adds "per dozen" after every price, but that dont make sense in the current scenario.
.price .amount:after {
content: " per dozen";
}
I would like to show the prices on this variable products this way:
$5.50 per dozen – $100.00 per case (quantity number)
Thanks in advance for any help.
This code resolve one of issue:
Here you are going to be able to add custom labels just as you want using a custom function hooked in
woocommerce_price_html
andwoocommerce_variation_price_html
filters hooks (for simple and variables products.For the min / max prices in variables products, we need a separated function hooked in
woocommerce_variation_sale_price_html
filter hook.This will avoid to have a repetitive "per dozen" everywhere.
Update2
Here is that working and tested code (see the screenshots at the end):
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
Here is a real screenshot from my test sever:
This code is tested and really works.
Related answers: