Support

Home Forums Event Espresso Premium Ways to empty the cart

Ways to empty the cart

Posted: February 6, 2014 at 2:43 am


Morten Mouritzen

February 6, 2014 at 2:43 am

do_shortcode
do_shortcode(‘[ESPRESSO_CANCELLED]’);

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?


Dean

February 6, 2014 at 4:41 am

Hi,

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


Morten Mouritzen

February 6, 2014 at 4:43 am

Hello Dean ๐Ÿ™‚

Ok i see.

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?

Do you see any problem with that?


Dean

February 6, 2014 at 5:05 am

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).


Morten Mouritzen

February 6, 2014 at 5:07 am

Yea i already have a custom_functions.php ๐Ÿ™‚

Ok Dean, thanks for the help.

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.

Event Espresso