Support

Home Forums Event Espresso Premium Customize "Add to Cart Button" in Multi Event Registration addon

Customize "Add to Cart Button" in Multi Event Registration addon

Posted: August 20, 2015 at 4:15 pm


katearpin

August 20, 2015 at 4:15 pm

Hi,

I have Multi Event registration plugin installed with my Event Espresso 4. However, I have noticed that when there is already an event in the cart, the “Add to Event Cart” button changes to “View Event Cart”. It should stay as “Add to Event Cart”. How can I fix this?

Also, I’d love to change it so it just said “Add to Cart” (without ‘Event’).

Please help!


Dean

August 21, 2015 at 1:20 am

Hi,

You can rename Event Cart with the following code added to a Site Specific Plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/):

function rename_event_cart() {
  return 'Cart';
}
add_filter('FHEE__EED_Multi_Event_Registration__set_definitions__event_cart_name','rename_event_cart');

Regarding to View Event Cart, you *can* change the view to add to, but this may actually cause confusion. The view only shows once the event has been added to the cart, and will not show for events that haven’t yet been added to cart. The confusion will come when, after changing the wording, someone clicks the add to cart link and it instead shows them the cart.

If you still want to do it, then this function can be added.

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
      'View %s' => 'Add to %s',
        // 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 );

The support post ‘Customize "Add to Cart Button" in Multi Event Registration addon’ 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