Add text before product price if it's higher than a specific amount in Woocommerce
In Woocommerce I'm trying to add text before price if is higher than 59€ I tried the following code (and others one) but they didn't work: add_filter( 'woocommerce_get_price_html', 'custom_price_message' ); function custom_price_message( $price ) { if ($price>='59'){ $new_price = $price .__('(GRATIS!)'); } return $new_price; } How can I do to add (GRATIS!) text before product price if it's higher than 59? Updated: You should try the following revisited function code: add_filter( 'woocommerce_get_price_html', 'prepend_text_to_product_price', 20, 2 ); function prepend_text_to_product_price(