I happen to have a specific case where I am displaying multiple add to cart forms on a single product display page.

The module works perfectly and adds the right products when each button is clicked.

But... I would really like to have a way to add a class to said button after the AJAX has completed so that I may style it differently, to show the user that they have already added this product, or, even show a remove from cart button instead.

I'm wondering if adding the class might be a pretty easy fix, but it's going to take me a long time to figure my way through the module code... Perhaps someone can suggest where to edit, or even suggest a patch?

Hope someone can help, this would be a fantastically useful feature (well for me obv)

Regards

Comments

subhojit777’s picture

Priority: Critical » Normal
Status: Active » Closed (won't fix)

Well, this feature cannot be generic. You have to handle such things in your project itself. The add to cart button is not rendered from this module. This module only adds an AJAX behavior to add to cart button.

I guess the fix will be - inside the preprocess function of add to cart form (or form alter) you can check for the presence of product in current user's order, and then alter the add to cart button according to it.