Support

Home Forums Event Espresso Premium Alert when clicking add to cart button

Alert when clicking add to cart button

Posted: February 12, 2020 at 5:24 pm


californiasteve

February 12, 2020 at 5:24 pm

My client wants an alert/popup to happen when the “add to cart” button is clicked. I would imagine a continue/ok button on the popup to add to cart or decline. Any ideas of a plugin or coed snippet?


Josh

  • Support Staff

February 12, 2020 at 5:32 pm

Hi,

The Multi Event Registration add-on adds this. May I ask do you have that plugin installed on your site? If so, you should already see a modal window open when adding an event to the cart. If you’re not seeing this happen, maybe you can share a link to an event on your site so we can investigate?


californiasteve

February 12, 2020 at 5:57 pm

I was probably not clear enough. I need a custon text on the modal that says “If you bought the full registration this item is already included” and the a continue or delete before it adds it to the cart.


Josh

  • Support Staff

February 13, 2020 at 3:04 pm

Hi,

Adding/modifying the text within the modal can be done with a text snippet. Changing the behavior of the Add to cart button to make it not actually add to the cart would require a significant rewrite of the plugin. If there’s a specific text string within that modal that you’d like to change its wording I can point you to a specific filter hook that allows for changing that string.


californiasteve

February 13, 2020 at 5:11 pm

Yes, adding/modifing to the text string would work.


Tony

  • Support Staff

February 14, 2020 at 5:04 am

To change the ‘1 item was sucessfully added for this event’ string you can use the FHEE__EED_Multi_Event_Registration__get_cart_results_results_message filter.

Example: https://gist.github.com/Pebblo/c0a730bf7396964f1d58bd6ebbc96b9a

To change the ‘THERE ARE CURRENTLY X ITEMS IN THE EVENT CART.’ text you can use the FHEE__EED_Multi_Event_Registration__get_cart_results_current_cart_message filter in a very similar way to the above.


californiasteve

February 18, 2020 at 7:11 pm

Can this be edited to target a specific ticket?


Josh

  • Support Staff

February 19, 2020 at 10:11 am

Hi,

You could work with tickets within the context of that message. Here’s another example based off Tony’s example that shows how to get and display the names of the tickets that are currently in the cart:

https://gist.github.com/joshfeck/3b0c0049c06910680611e22d717ce078

From there you could get Ticket IDs, add logic, then display different custom messages based on what’s already in the cart. If you’re not sure how to work with objects or arrays and php conditionals then it’d probably be best to team up with a PHP developer to help get this done for your client.

The support post ‘Alert when clicking add to cart button’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 1 month, 2 weeks ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!