Support

Home Forums Event Espresso Premium Changing the text once an event is added to the cart using tables

Changing the text once an event is added to the cart using tables

Posted: October 3, 2016 at 11:04 am


nathan.yerxa

October 3, 2016 at 11:04 am

Currently I’m using the table view template specifically the toggle view template with some customized features. For a registrant to add and event to the cart, they select “ADD to CART” and it adds a value of 1 event to the cart. After the event is added to the cart the former “ADD to CART” button text changes to “View Event Cart”.

Is there a way to change the text from “View Event Cart” to “Selected” or “Scheduled”? If so where would this take place?

Thank you for your time and help.


Tony

  • Support Staff

October 4, 2016 at 4:32 am

Hi there,

Can you link me to page you want to change the text on please?

You should be able to translate the text (or we may have a filter in place) but I just want to confirm I am looking at the correct location.


nathan.yerxa

October 4, 2016 at 8:35 am

Tony,

One of the pages with the table is https://seminar.apems.org/seminar-pass-friday-saturday/

The table has been modified to only allow a value of 1 added to the cart when the “Add to Cart” button is selected. After pressing the “Add to Cart” button the text of the button changes to “View Event Cart”. It is the “View Event Cart” text that appears after the button click I wish to change to “Selected” or “Scheduled”.

Thanks,
Nate


Tony

  • Support Staff

October 6, 2016 at 5:51 am

The ticket selector button text (which is what you are referring to) is filterable so it can be changed to whatever you prefer.

However as your using MER, which also filters the ticket selector text based on the cart you will need to allow MER to first “do its thing” and return the button text and then change it whatever you need.

You can do this using something like this:

https://gist.github.com/Pebblo/00e163c2882e41741d6a86e42b543cc1

MER hooks in at priority 10, the above hooks in at priority 20 so its runs after MER.

It checks if the btn_text is ‘View Event Cart’ and if so changes it to ‘Scheduled’.

However note that the filter is ran on all instances of of the ticket selector (TS), so if you have other pages showing the TS they will also show Scheduled for events that have been added to the cart.


nathan.yerxa

October 6, 2016 at 7:15 am

Tony,

Thank you for the help. This is definitely what I’m looking to accomplish. You mentioned MER, which I am currently using, which leads me to the next question.

Initially I thought I would be targeting the espresso-events-table-template-toggle.template.php to make these changes since I’m calling the toggle table on the page. Is that still the case if I’m using MER? Or, do I need to do something different.

Thank you,
Nate


Tony

  • Support Staff

October 6, 2016 at 7:24 am

Although the template displays the events, the ticket selector is a part of Event Espresso core so you don’t edit that from within the template.

The function I shared above can be used within either your themes functions.php (preferably using a child theme) or you can create a Custom Functions Plugin and then add that function there to change the text.


nathan.yerxa

October 6, 2016 at 7:32 am

Tony,

Thank you for the clarification and help. I have a EE4 Custom Plugin that I’ll add this too.

Best Regards,
Nate


Tony

  • Support Staff

October 6, 2016 at 7:33 am

You’re most welcome 🙂

If you run into any problems please do let me know.

The support post ‘Changing the text once an event is added to the cart using tables’ 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