Support

Home Forums Event Espresso Premium Customizing Checkout button text

Customizing Checkout button text

Posted: September 21, 2015 at 9:35 pm

Viewing 11 reply threads


denise

September 21, 2015 at 9:35 pm

Hi,

I found this article which was really helpful: https://eventespresso.com/wiki/customize-checkout-registration-button-text/

I have a question about the add to event cart button; When I add an event to the cart and then click “Return to Events lists”, if I click on the same class and maybe wanted to add another event of the same type, I now see “VIEW EVENT CART” instead of “ADD TO EVENT CART”. How do I change that text for VIEW EVENT CART, its confusing.

Second question is I would like to also change the text on the RETURN TO EVENTS LIST button. Could you share the sample code for that?

Thanks
Denise


Tony

  • Support Staff

September 22, 2015 at 2:59 am

Hi Denise,

I have a question about the add to event cart button; When I add an event to the cart and then click “Return to Events lists”, if I click on the same class and maybe wanted to add another event of the same type, I now see “VIEW EVENT CART” instead of “ADD TO EVENT CART”. How do I change that text for VIEW EVENT CART, its confusing.

‘View Event Cart’ should only be displayed if the user already has that event added to the cart, because they don’t need to re-add that same event to the can, they can just view the cart and update the ticket qty they originally selected for that event.

Can you link me to your event page so I can view this please?

Changing the return to event list text can be done using something like this:

function ee_my_custom_return_to_events() {
	return 'Custom text to return to events';
}
add_filter( 'FHEE__EED_Multi_Event_Registration__return_to_events_list_btn_txt', 'ee_my_custom_return_to_events' );


denise

September 23, 2015 at 10:40 am

I agree they might have already added it to the cart, but then they might get confused about it if they click on the event again and don’t see the option to add another one just to view event cart. Here is the website sorry I forgot to add it to my question:

http://miyceramics.com/2015-calendar/

I will try the code too and see how that logic works thanks!


Tony

  • Support Staff

September 24, 2015 at 8:11 am

Yeah I can that applies with your use case, the tickets are each an individual day so they may add one to the cart, then decide to add another.

The easiest way to change the View cart text is to use something like this:

function custom_view_cart_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', 'custom_view_cart_filter_gettext', 10, 3 );

Which basically translates the ‘View %’ to ‘Add to %s’, the %s is replaced buy the cart info (to ‘Event Cart’) and needs to be left as is for this to work.


denise

October 6, 2015 at 8:15 pm

Hi Tony,

Thanks for you help. I added this to my “custom” plugin, but the text doesn’t seem to change. Do I need to put this someplace else?

Thanks
Denise


Lorenzo Orlando Caum

  • Support Staff

October 7, 2015 at 8:49 am

Hi Denise, the gettext filter that Tony shared will work. However, it should only change the text once an item has been added to the event cart:

http://cl.ly/image/2z3j34313W0a


Lorenzo


denise

October 13, 2015 at 10:38 pm

Hi Lorenzo,

When you tried it, did you add an event to the cart, and then go back and try to add another of the same type of event to the cart? The second time around the button says “view event cart” which can be confusing if someone wanted to add a guest after they already added one.


Tony

  • Support Staff

October 14, 2015 at 5:24 am

Hi Denise,

Are you using the browser back button?

If you add an event to the cart, and click to go back that get_text filter should work.


denise

October 15, 2015 at 9:34 am

Hi Tony,

I am using the button that says ” return to events page”, which then takes me back to the events page. I then go and find the event that just registered for and the button still says “view event cart”.

In my scenario 1 event page has multiple event dates, have you tested this function with that scenario?


Lorenzo Orlando Caum

  • Support Staff

October 15, 2015 at 10:58 am

Hi, that scenario also works:

http://cl.ly/0Q2a3t453p1u/Screen%20Recording%202015-10-15%20at%2012.56%20PM.mov

Could you confirm that you are adding the gettext filter to your child theme or through a site specific plugin?


Lorenzo


denise

October 15, 2015 at 11:05 am

Hi Lorenzo and Tony,

Sorry you were both right. I had a typo in one of my comments that was preventing the filter. It works as is.

Thanks for your support!
Denise


denise

October 15, 2015 at 11:12 am

Okay I need to add on to this thread for more customization

For the “RETURN TO EVENTS LIST” code:

function ee_my_custom_return_to_events() {
return ‘Custom text to return to events’;
}
add_filter( ‘FHEE__EED_Multi_Event_Registration__return_to_events_list_btn_txt’, ‘ee_my_custom_return_to_events’ );

Do you have a similar function for the “Proceed to Registration” button?

I would rather return back to the full calendar which is easier to read. Can I change the link this button goes to?

Viewing 11 reply threads

The support post ‘Customizing Checkout button text’ 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