Last active
November 27, 2017 03:52
-
-
Save neilgee/fb53b758ac40aeac94c2 to your computer and use it in GitHub Desktop.
WooCommerce Text After Price
This file contains 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
<?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