Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // WooCommerce - add some text before the price for selected products
- // snippet goes in functions.php for your child theme
- // you can one or many "case" lines. Use your own product ids.
- // Intended for simple products only
- add_filter( 'woocommerce_price_html', 'add_from', 10, 2 );
- function add_from( $price, $product ) {
- $product_id = $product->get_id();
- switch ($product_id) {
- // list of product ids where this applies
- case 1801:
- case 2479:
- return 'From: '.$price;
- break;
- default:
- // any other products
- return $price;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement