Magento 2: Want to change the location of Product Page “Your added …shopping cart” message, under the addto cart button
-
13-04-2021 - |
Question
Solution
Follow the bellow steps to move the success message to the desired place.
- Create the
default.xml
in your module (app/code/VendorName/ModuleName).
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="product.info.main">
<container name="page.messages"
htmlTag="div"
htmlClass="page messages"
after="-">
<block class="Magento\Framework\View\Element\Template"
name="ajax.message.placeholder"
template="Magento_Theme::html/messages.phtml"/>
<block class="Magento\Framework\View\Element\Messages"
name="messages" as="messages"
template="Magento_Theme::messages.phtml"/>
</container>
</referenceContainer>
</body>
</page>
- Below is the result for the theme Magento Luma:
Hope this helps.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange