Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
How to Show a Ticket with a Price of Zero as Free | Event Espresso - Staging Server

How to Show a Ticket with a Price of Zero as Free

In this post we’ll learn how to show tickets that have a cost of zero as free. Lets begin by taking a look at the screenshot below:

ticket-selector-zero-pricing

We can see that we have a free ticket that has a pricing of zero (shown as 0.00). Do you host events that have free tickets? Wouldn’t it be great to be able to show the price as “free” instead of “0.00.”

You can enable this on your own site with a filter.

function convert_zero_to_free( $amount, $return_raw ) {
    // we don't want to mess with requests for unformated values because those may get used in calculations
    if ( ! $return_raw ) {
        $amount = $amount == 0 ?  __( 'free', 'event_espresso' ) : $amount;
    }
    return $amount;
}
add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 );

There are a couple ways to add the filter above to your site. The first is to add the code to your theme’s functions.php file. However, this edit may be lost if you update your theme and it removes and replaces the functions.php file. A safer method is to create a custom plugin.

Once this filter is in place, go to any events on your site that has a free ticket and you’ll see that the pricing has been transformed from 0.00 to free:

ticket-selector-free-pricing


Need more help?

  • Browse or search for more information on this topic in our support forums. Customers with an active support license can open a support topic and get help from Event Espresso staff.
  • Have an emergency? Purchase a support token and get expedited one-on-one help!
  • Go back to documentation for Event Espresso
Event Espresso - Staging Server