Support

Home Forums Event Espresso Premium Change message about maximum number of tickets that can be purchased

Change message about maximum number of tickets that can be purchased

Posted: July 31, 2015 at 11:14 am


Deborah Fox

July 31, 2015 at 11:14 am

I’ve limited the number of tickets available to individuals, but want to have an option for people to register larger groups by request. I added the following into an Espresso Customisation plugin on our site:

$strings = array(
‘Available Tickets’ => ‘Event Registration’,
‘Please note that a maximum number of %d tickets can be purchased for this event per order.’ => ‘*Please note that a maximum number of 4 tickets can be purchased for this event per order. To register a group larger than 4, please email a request to myemail.’,
// 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 );

This update worked for changing ‘Available Tickets’ to ‘Event Registration’, but the second message isn’t working. Why isn’t this working?


Tony

  • Support Staff

July 31, 2015 at 11:49 am

Hi Deborah,

The original string must match, so the original here needs to be:

‘Please note that a maximum number of %1$d tickets can be purchased for this event per order.’

Try

'Please note that a maximum number of %1$d tickets can be purchased for this event per order.' => '*Please note that a maximum number of 4 tickets can be purchased for this event per order. To register a group larger than 4, please email a request to myemail.',


Deborah Fox

July 31, 2015 at 12:20 pm

Wonderful — thank you, Tony!

The support post ‘Change message about maximum number of tickets that can be purchased’ 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