add_filter( 'woocommerce_get_price_html', 'change_zero_to_free', 9999, 2 ); function change_zero_to_free( $price, $product ){ if ( '' === $product->get_price() || 0 == $product->get_price() ) { $price = '<span class="woocommerce-Price-amount amount">FREE</span>'; } return $price; }