Support

Home Forums Event Espresso Premium Changing $0 to free is causing changes in the backend

Changing $0 to free is causing changes in the backend

Posted: February 18, 2015 at 6:25 pm


Adele Haswell

February 18, 2015 at 6:25 pm

Wordpress v4.1 EE v4.6.9

I have added the function to change $0 for the Event price to show free as per
https://eventespresso.com/topic/events-without-ticket-price/

However this is also affecting the backend so that in the Transactions the Paid amount is showing as free instead of $0.

Is there a work around for this?


Dean

February 20, 2015 at 3:27 am

Hi,

This function should make it so the paid amount is not affected in the admin

function convert_zero_to_free( $amount, $return_raw ) {

    // we don't want to mess with requests for unformatted values because those may get used in calculations
    if ( ! $return_raw ) {

    	if( is_admin() ) {  }
    	else { $amount = $amount == 0 ?  __( 'free', 'event_espresso' ) : $amount; }

    }
    return $amount;
}
add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 );

The support post ‘Changing $0 to free is causing changes in the backend’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso