MMv4 KB
 
Emptying a Customer's Basket Using "Add to Cart" links
  Last Edited - 12/5/2012 2:18pm PST
  Category Path - Editorial > Blogs > Tips, Tricks and Astounding Revelations
 
"Add to Cart" links are quite useful for adding products to a customer's order, but did you know that they can also be used to empty a customer's cart too? This can be very useful when you want to remove any products present in the customer's cart before adding new products to it.

To empty the contents of the customer's cart, include the variable empty=Y in the "Add to Cart" link code.

example
This modified "Add to Cart" link will first empty the customer's shopping basket, and then add product SID 123 to it:
http://www.MyStore.com/quick_basket.php?id1=123&qty1=1&empty=Y

The order of the variables in the link does not matter. The empty=Y variable may appear first, second, third, etc. in the link's list of variables.

The value of the empty variable can be anything, it doesn't necessarily need to be "Y" as used in the examples above.

reference
If you aren't familiar with "Add to Cart" links, be sure to read the introduction to "Add to Cart" links Knowledge Base article.
Powered by ModularKB