Skip to content

Instantly share code, notes, and snippets.

@neilgee
Last active November 27, 2017 03:52
Show Gist options
  • Save neilgee/fb53b758ac40aeac94c2 to your computer and use it in GitHub Desktop.
Save neilgee/fb53b758ac40aeac94c2 to your computer and use it in GitHub Desktop.
WooCommerce Text After Price
<?php
//don't copy above opening tag if pasting into functions.php
//Add in text after price to certain products
function themeprefix_custom_price_message( $price ) {
global $post;
$product_id = $post->ID;
$my_product_array = array( 799,796,792 );//add in product IDs
if ( in_array( $product_id, $my_product_array )) {
$textafter = '( Upfront Paid in Full Price )'; //add your text
return $price . '<br /><span class="price-description">' . $textafter . '</span>';
}
else {
return $price;
}
}
add_filter( 'woocommerce_get_price_html', 'themeprefix_custom_price_message' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment