Is there a way to add product SKU on add to cart alert notification right now it shows the product name and I want to display the SKU also. Please see the attached screenshot.


For your Magento version 2.2.2. We just need to override the add to cart controller: Magento\Checkout\Controller\Cart\Add

In execute method, we need to change the message (line 123 ~ 130)

     $message = __(
                    'You added %1 SKU: %2 to your shopping cart.',

Later versions (for example 2.3), there are two places we need to change.

In execute method, we need to change

                            'product_name' => $product->getName(),
                            'product_sku' => $product->getSku(),
                            'cart_url' => $this->getCartUrl(),

We also need to change the template: view/frontend/templates/messages/addCartSuccessMessage.phtml

<?= $block->escapeHtml(__(
    'You added %1 , SKU: %2 to your <a href="%3">shopping cart</a>.',
), ['a']);

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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