Home / Widgets / WooCommerce Change “$0.00” to “Free”
Duplicate Snippet

Embed Snippet on Your Site

WooCommerce Change “$0.00” to “Free”

Code Preview
html
/**
	* Snippet Name:	WooCommerce Change "$0.00" to "Free"
	* Snippet Author: ecommercehints.com
	*/
add_filter( 'woocommerce_get_price_html', 'ecommercehints_change_zero_price_display', 10, 2 );
function ecommercehints_change_zero_price_display( $price, $product ) {
if (empty($product->get_price()) || $product->get_price() == 0) { // If price is not entered or set to 0
$price = __( 'Free', 'woocommerce' );
}
return $price;
}

Comments

Add a Comment