I take it that no “echo” is needed infront since is a action and not a output?
Page with shortcode
Redirect to some page with this shorcode on and the cart will be emptied [ESPRESSO_CANCELLED]
Adding a link to press which clears the cart
Something like.. <a href="some_ee_url">Clear cart</a>
Its important to note that im refering to a AJAX look-a-like functionality. Im not interested in a page reload or a page-redirect, i can do that with the upper two. The empty cart link have to function the same was as “add to cart”. A spinnin wheel (gif file i presume) will apear and the functionality will be executed.
The top 2 solutions is not a issue, im just showing what i already know. The one im missing is bottom solution with the HTML link.
Is that possible?
This topic was modified 10 years, 9 months ago by Morten Mouritzen.
This topic was modified 10 years, 9 months ago by Morten Mouritzen.
This topic was modified 10 years, 9 months ago by Morten Mouritzen.
There isn’t an inbuilt way to clear the cart in one go, barring heading over to the [ESPRESSO_CANCELLED] page, which basics launches a PHP function to clear the session.
You could perhaps modify the jQuery that deals with deleting a single event from the cart and create a new function to clear all and attach that to a button
I take it that it would be totally possible for me to write a new function called __ex_clear_cart(); and make that function clear the cart session array?
I don’t see any issues, so long as you load the jQuery in correctly. I would advise using the custom_functions.php or a custom plugin to load the jQuery.
Of course you will need to edit the cart template as well to insert a button (unless the button is in the sidebar etc).
The support post ‘Ways to empty the cart’ 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.