I have a relatively straightforward module in Magento 2 for adding some extra functionality to the addto area on the product view page.
I wanted to append my own custom block after the product.info.addto block via a layout file, like so:
app/code/VENDOR/MODULE/view/frontend/layout/catalog_product_view.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.options.wrapper.bottom">
<block
class="VENDOR\MODULE\Block\Product"
name="product.info.anyname"
template="VENDOR_MODULE::test.phtml"
after="product.info.addtocart" />
</referenceBlock>
</body>
</page>
with my template test.phtml file being a simple echo for now:
app/code/VENDOR/MODULE/view/frontend/templates/test.phtml
<?php echo 'LA TREY: '; ?>
after enabling module, and running the di:upgrade
, compile
and cache clear
php bin/magento
commands, I go to my catalog product view page and no change. My "La Trey" isn't there.
So I thought I could win by copying the layout/catalog_product/view.xml file to the theme's Magento_Catalog folder - but again, after running the commands - nothing.
How do I get my block to show after the addto container on the catalog product view page?