Support

Home Forums Event Espresso Premium Add to Cart – Remove from Cart

Add to Cart – Remove from Cart

Posted: March 7, 2013 at 10:38 pm


Wendy Goudie

March 7, 2013 at 10:38 pm

Hi

I am trying to alter the Add to Cart function. Instead of the “Add to Cart” changing to “View Cart”, I would like “Add to Cart” to alternate with “Remove from Cart” (and keep the viewer on the same page). Someone else asked the same question and resolved it somehow, but I don’t know how. Please help. Thanks.

https://eventespresso.com/topic/trying-to-hack-add-to-cart-button-functionality/


Dean

March 8, 2013 at 1:28 am

Hi,

Right, this may not be the best way to do it but it seems to work.

This goes in the same area (cart.php just after the view cart stuff around line 1049)

echo '<span class="remove-cart-item multi_reg_cart_block"><img class="ee_delete_item_from_cart" id="cart_link_' . $event_id . '" alt="Remove this item from your cart" src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/icons/remove.gif" /></span> ';


echo '<script type="text/javascript">';

echo "jQuery('.remove-cart-item').click(function() {
location.reload();
});";
echo '</script>';

What it does is add the cart remove button from the cart page and then forces the page to reload so the spinning icon goes away and the add to cart button re-appears.

The support post ‘Add to Cart – Remove from 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