Support

Home Forums Event Espresso Premium Filter or Option for "Payment Method Header" Warning

Filter or Option for "Payment Method Header" Warning

Posted: January 3, 2016 at 11:36 pm


Steve Ryan

January 3, 2016 at 11:36 pm

Good evening. I was wondering what the best way to go about changing a piece of text on the checkout page to a different phrase. If the best (or most straightforward) method is using a filter, can you please provide an example?

The text in question is:
<h3>Important information regarding your payment</h3>

I’d ultimately like that text to change depending on the payment method that is actively selected, but if that’s not easily possible, I’d settle for the ability to change the text to:
<h4>Please finalize your payment</h4>

Thanks for your assistance.
— Steve Ryan


Tony

  • Support Staff

January 4, 2016 at 3:59 am

Hi Steve Ryan,

Currently you can not modify that text based on the payment method selected or change the tag around the string easily.

You can modify the text itself using something like:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
       'Important information regarding your payment' => 'Please finalize your payment',
        // Add some more strings here
    );
 
    // See if the current string is in the $strings array
    // If so, replace its translation
    if ( isset( $strings[$original] ) ) {
        // This accomplishes the same thing as __()
        // but without running it through the filter again
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );

Which is using the example function show here:

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function

The support post ‘Filter or Option for "Payment Method Header" Warning’ 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