I have tried to relocate in layouts XML file, but it's not working. the file is in the/vendor/magento/module-checkout/view/frontend/templates/messages/addCartSuccessMessage.phtml I just want to put this line under the add to cart button or after the short description pannal. (Magento 2.3.4) enter image description here

1 Answer 1


Follow the bellow steps to move the success message to the desired place.

  1. Create the default.xml in your module (app/code/VendorName/ModuleName).
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        <referenceContainer name="product.info.main">
            <container name="page.messages" 
                       htmlClass="page messages" 
                <block class="Magento\Framework\View\Element\Template" 
                <block class="Magento\Framework\View\Element\Messages" 
                       name="messages" as="messages"
  1. Below is the result for the theme Magento Luma: Success Message Moved

Hope this helps.

  • Thank you so much. it works can you please tell me how to post it above the description Apr 23, 2020 at 12:01
  • ok it's solved I put before instead of after, Thanks Man Apr 23, 2020 at 12:12
  • 1
    Sure man. I was working on that only. Happy that you were able to get the result. Are you going to accept the answer? Apr 23, 2020 at 12:17
  • yes, i gave the thumbs up Apr 23, 2020 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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