Add text after price
-
I found this very useful code for adding text after price:
add_filter( 'woocommerce_get_price_html', 'njengah_text_after_price' ); function njengah_text_after_price($price){ global $post; $product_id = $post->ID; $product_array = array( 1,2,3 );//add in the product IDs to add text after price if ( in_array( $product_id, $product_array )) { $text_to_add_after_price = ' text to add after price for the specific products '; //change text in bracket to your preferred text return $price . $text_to_add_after_price; }else{ return $price; } }
Only problem is, I have to enter individual post ID to the array. How can I make this applied to all posts under certain category or tag?
Thanks in advance!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add text after price’ is closed to new replies.