How to alter the message shown - "xyz" added to your cart, when we add an item to cart in Drupal 8 Commerce 2x.

I saw Drupal\commerce_cart\EventSubscriber where the function displayAddToCartMessage(CartEntityAddEvent $event) is written which is responsible for showing the message, is there any method to override it.


Install the Commerce Extended Quantity module and then implement a HOOK_xquantity_add_to_cart_qty_prices_msg_alter(): https://github.com/drugan/commerce_xquantity#an-item-added-to-your-cart-message-alter

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.