Created
October 7, 2013 21:24
-
-
Save jameskoster/6875202 to your computer and use it in GitHub Desktop.
WooCommerce - add text after price
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_get_price_html', 'custom_price_message' ); | |
function custom_price_message( $price ) { | |
$vat = ' (plus VAT)'; | |
return $price . $vat; | |
} |
hi,
i followed the above code and managed to add some extra text after my price, but still over the "Add to Cart" button the text is not there, it appears only on the top of the product page under the title. Is there a way to change this as well?
Is it possible to load a widget after price, on the right?
Hi,
For simple product, i try this code:
add_filter( 'woocommerce_get_price_html', 'custom_price_message' );
function custom_price_message( $price ) {
global $product;
// Limit to a specific product ID only (Set your product ID below )
if( $product->get_id() != 168 ) return;
// The content start below (with translatables texts)
?>
<?php
$vat = ' TTC/unitaire';
return $price . $vat;
}
Hi,
can you please tell me how can I show the text ((*Incl. of all taxes) after a price on a single product page(wordpress) not is all product pages or in category pages? I just want to show this on a single product page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
I have added the code snippet with CSS styles. However, since I already apply a font size change to the price using !important, when I try to apply a smaller font size to the text in brackets, it gets to use the price font size. How do I get this particular CSS font size to be applied only to the text.
Thanks
Lyse