1

I have a Drupal 7 / Ubercart 3 website. How can I disable the "Add to Cart" button on only some products? For instance, if I wanted to list product ABC but did not want to actually sell it online, I'd like for its "add to cart" button to either be hidden or to display a different button that would not be clickable.

The only solution I could find is for D6 (https://drupal.org/project/uc_disable_product).

Thanks!

1

On What ever products you dont want customers to buy or add to cart, the easiest solution is just hide them using css for that button alone.

.parentclass #add-to-cart
{
  display:none;
}

Or

you can use uc_auction module and let the products be auctioned for particular period of time.there will be no add to cart button.

  • Thanks for your input. I do have them hidden via CSS, I was just hoping for more of an admin-input type of solution. I will take a look at uc_auction to see if it will fiy my needs. – hockey2112 Jul 26 '13 at 19:19
1

edit: new answer/idea

Assign a new toggleable attribute to your products. Access the product display template (or hook?) and check for that attribute and change/disable/remove the "add to cart" button if it's found.

  • I did as you mentioned, but the "Add To Cart" button remains on the page (and is clickable) even when stock is set to $0. – hockey2112 Jul 26 '13 at 19:19
  • Sorry, I think I lead you on a wild goose chase there. I just had a chance to look at an older UC site, the stock controls do NOT work like that. I'm updating my answer for you though, I have another idea. – jdu Jul 26 '13 at 20:48
  • That new suggestion is a great idea. I've actually done that before for other fields... I should have thought of that for the add to cart button! I suppose the only issue would be on catalog pages that list a bunch of products, but I could probably just rewrite the "add to cart" button field in the catalog view with the same show/hide that I would use in the product page template, right? – hockey2112 Jul 29 '13 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.