Add text “From” before price for Woocommerce
In some cases, your product has different selling prices for different variations, the product price will be displayed as below:

And it looks pretty ugly, to shorten it like this:

You can use the code I shared below to add the text ‘From’ before the price of a product in a page listing or related products:
1 2 3 4 5 6 7 8 | add_filter('woocommerce_get_price_html', 'hvm_prefix_price', 99, 2); function hvm_prefix_price( $price, $product ) { global $related_products; $show = false; if ( (isset($GLOBALS['woocommerce_loop']['name']) && $GLOBALS['woocommerce_loop']['name'] !='') || is_product_category() || is_shop() ) $show = true; return ($show? 'From ': '') . $price; } |
Done, F5 website!


![[ Hướng dẫn ] Cách đăng kí 100GB Google One miễn phí trong 4 năm 9 [ Hướng dẫn ] Cách đăng kí 100GB Google One miễn phí trong 4 năm](https://huanvm.com/wp-content/uploads/2023/06/huanvmdotcom-google-one-free.jpg)






