I use commerce checkout on a Drupal site but it is primarily an information site. So I effectively want to hide the cart from the user.

This means that on addition of a product to the cart, I want to remove the Drupal message 'Product' added to your cart.

This can't just be hidden in CSS because we want other checkout messages to still be visible.


I'm pretty sure that's just set by a rule called "Display an Add to Cart message".

You should be able to delete/disable that rule in the UI and the message will disappear.


@Clives's answer is correct and for those looking for Ctrl + C and Ctrl + V

 * Disable adding to the cart the messages.
function HOOK_update_7000() {
  $rules_config = rules_config_load('commerce_cart_add_to_cart_message');
  $rules_config->active = FALSE;
  • where would be the best place to put this code? Oct 23 '18 at 20:19
  • @AaronAffleck Welcome to Drupal Answers! I converted your answer to a comment until you have enough rep to comment directly. hook_update_N() functions go in a mymodule.install file. It's can't go in a theme, and not a .module file, just a .install for one of our modules.
    – mpdonadio
    Oct 23 '18 at 21:12

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.