Article

How to hide Drupal 7 Commerce Add to Cart functionality without hacking on the code or template overrides and theme hooks

Product Display > Manage Display 

  1. Go to the Product Display (node) Display Settings
  2. Identify which Display View you want the add to cart feature disabled
    Drupal-Commerce-hide-add-cart-product-display.png
  3. Assuming "Product" is the referenced field, hide the Product reference field and hide any of the injected product attribute fields that you wouldn't want displayed. Switch from "Add to Cart" to "Hiden"
    Drupal-Commerce-hide-add-cart-product-display-2.png

Hide only Add to Cart button selectively by CSS

If you still want the Add to Cart feature sitewide and yet wants only to hide it from certain sections, views or blocks, hide the button by CSS:

  • Identify the block or view where the Add to Cart button will be disabled
  • Get the block or View's ID
  • Set CSS rule like below (where "products-shop-block-featured-homepage" is the specific id of my block) then appended the default commerce add to cart style rule
#products-shop-block-featured-homepage .commerce-add-to-cart {
    display: none;
}