How To: Hide WooCommerce "From:" Label

Advertisement

This little snippet simply hide “From:” label from product category or in shop page display, WooCommerce is an easy and flexible to use Ecommerce solution for WordPress with the use of WordPress hooks everything works perfectly.


/**
 * Hide the 'FROM: ' label
 */
function woocommerce_hide_from_label( $price ) {
	$price = str_replace( '<span class="from">From: </span>', "", $price );

	return $price;
}

add_filter( 'woocommerce_variable_price_html', 'woocommerce_hide_from_label', 10 );
add_filter( 'woocommerce_grouped_price_html', 'woocommerce_hide_from_label', 10 );
add_filter( 'woocommerce_variable_sale_price_html', 'woocommerce_hide_from_label', 10 );

To replace “From:” label, update the above code to


// this is helpful for internalization
$price = str_replace( '<span class="from">From: </span>', "New Label", $price );

If you think you have a good solution out there, feel free to share.

Happy coding ^_^

Advertisement