How to hide Drupal 7 Commerce Add to Cart functionality without hacking on the code or template overrides and theme hooks
October 22, 2017
Product Display > Manage Display
- Go to the Product Display (node) Display Settings
- Identify which Display View you want the add to cart feature disabled
- 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"
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; }
- Log in to post comments