Support

Home Forums Event Espresso Premium View Event Cart Button – change text – other solutions not working

View Event Cart Button – change text – other solutions not working

Posted: March 5, 2018 at 4:51 am

Viewing 5 reply threads


David Traxler

March 5, 2018 at 4:51 am

Hi, on our registration page when you add an event to the cart using the “+” button the text changes to “View Event Cart” http://sciencediscoverycamp.com/register-online/

I have tried to change this text via the following two methods with now luck:
https://gist.github.com/Pebblo/00e163c2882e41741d6a86e42b543cc1/f38c1953f02db723d8c1e96f25bf836d555a7bfb
https://gist.github.com/joshfeck/e253df387ddd710cb739338d20065f4a

I currently use the following filter to change the add to cart button to a “+”

http://pasted.co/f89c58c1

Thanks for the help.


David Traxler

March 5, 2018 at 5:07 am

So I removed the filter that I use to change the add to cart button: http://pasted.co/f89c58c1

That made the other filter work(https://gist.github.com/Pebblo/00e163c2882e41741d6a86e42b543cc1/f38c1953f02db723d8c1e96f25bf836d555a7bfb) , being a novice I have no idea how to combine these to changes into one filter.

Anyone happy to lend a hand?


David Traxler

March 5, 2018 at 5:29 am

So I’ve updated the filter to:

add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', 'tw_ee_custom_filter_ticket_selector_submit_button_text', 15, 2 );
function tw_ee_custom_filter_ticket_selector_submit_button_text( $btn_text, $event ) {
	
	if( $btn_text === 'View Event Cart' ) {
		$btn_text = '✓';
	} else {
		$btn_text = '+';
	}

	return $btn_text;
}

This works when I refresh the page, however, when clicking the “+” to add an event to the cart the button still changes to “view event cart”.


Tony

  • Support Staff

March 5, 2018 at 5:34 am

Hi David,

You can’t easily prevent the button from changing with the ajax call adding the tickets to the cart, but what you can do is change it back to whatever you want before the user sees using jQuery.

See this example: https://gist.github.com/Pebblo/f7cdd911c2cc668c7ea0b13dcbab45c7

(Borrowed from Josh’s example above and altered to suit)


David Traxler

March 5, 2018 at 6:04 am

I’ve exhausted all possible searching on the forum and I cannot find a way to change the text of the button when it dynamically changes after adding an event to the cart. Where is this text being pulled from?!


David Traxler

March 5, 2018 at 7:26 am

That has worked great! Thanks

/solved

Viewing 5 reply threads

The support post ‘View Event Cart Button – change text – other solutions not working’ 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