In light of the recent UI improvement to replace the "remove" checkboxes with remove buttons, I would like to add a "Clear Cart" button to make it easier to get rid of product kits that are set "As individual products". The problem we have is our product kits might have 20+ products in them, and it only takes 1 click to add the whole thing to the cart. If the customer changes their mind, it now takes them 20 click-waits to get the one kit out of their cart. That seems a bit ridiculous, even for the most sales-conversion oriented website. Furthermore, it might be nice to have it show up optionally for those sites that would rather make it difficult to remove a lot of products from a cart in an effort to increase sales conversion rate / ticket size.

A confirmation for the "Clear Cart" button ("Are you sure?") should also be implemented, to prevent accidental clearing of the cart.

Files: 
CommentFileSizeAuthor
#7 1258982-empty-cart-button.patch4.33 KBlongwave
PASSED: [[SimpleTest]]: [MySQL] 2,725 pass(es).
[ View ]
#5 uc_emptycart.tgz807 bytesbancarddata
#3 uc_emptycart.tgz836 bytesbancarddata

Comments

It's possible to empty the cart (with confirmation) using Cart Links... for all the gory details on that, see the discussion at #881752: Cart Links - Missing code for "Empty cart" function. Or I suppose you could do a form_alter on the cart form and use uc_cart_empty().

Status:Active» Closed (duplicate)

Thanks for the input, SeanA. I am just going to close this as a duplicate based on the thread you linked to, and perhaps take your 2nd approach. I don't need all the links (and security debate) that Cart Links provides. When/if I come up with my solution, I will post it back here for any who are requiring just a simple empty cart link on the cart page and none of the rest.

StatusFileSize
new836 bytes

Attached is a basic module to add an Empty cart link to the cart page in UC 7.x-3.x.

Status:Closed (duplicate)» Active

No problem with leaving this open; an "empty cart" button on the cart page is a different feature to cart links and would not present a security risk.

StatusFileSize
new807 bytes

Here is a cleaned up version of the module that better conforms to recommended conventions.

hello,

does your module work with the latest dev version?
I am asking because your latest message is more than one year old.

Thank you

Status:Active» Needs review
StatusFileSize
new4.33 KB
PASSED: [[SimpleTest]]: [MySQL] 2,725 pass(es).
[ View ]

This patch adds an optional empty cart button, with confirmation page and test cases. Enable it at /admin/store/settings/cart.

Status:Needs review» Needs work

The last submitted patch, 1258982-empty-cart-button.patch, failed testing.

Status:Needs work» Needs review

Strange testbot failure; failed in catalog module testing, with message: exception 'DatabaseSchemaObjectExistsException' with message 'Table variable already exists.' in /var/lib/drupaltestbot/sites/default/files/checkout/includes/database/schema.inc:657

#7: 1258982-empty-cart-button.patch queued for re-testing.

thanks !!!

so far I didn't noticed any bug.

Status:Needs review» Fixed

Committed #7

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.