I'm using Magento 2.4.7-p1 and I'm trying to show programmatically a customer block on the success page from my module but without success.
The module seems correctly enabled and registered but the custom block is not shown. No other info in the log files. I also run magento setup:upgrade, magento cache:flush, etc. Products are downloadables.
Here's what I done:
Vendor/Module/registration.php
<?php
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'Vendor_Module',
__DIR__);
Vendor/Module/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Module" setup_version="1.0.0">
</module>
</config>
Vendor/Module/view/frontend/layout/checkout_onepage_success.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>
<referenceContainer name="order.success.additional.info">
<block class="Magento\Checkout\Block\Onepage\Success"
name="test2.order.success"
template="Vendor_Module::order/success.phtml"
cacheable="false"
after="-">
</block>
</referenceContainer>
</body>
</page>
Vendor/Module/view/frontend/templates/order/success.phtml
<?php
echo "My custom content!";
Edit:
I also tried to set a sequence like this:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Module" setup_version="1.0.0">
<sequence>
<module name="Magento_Checkout"/>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
<module name="Magento_Vault"/>
<module name="Magento_Paypal"/>
</sequence>
</module>
</config>
Solution
I just forgot an s in the actual module name in the registration.php
. The actual name was Pettis_LinkOnSuccessPage
instead of Pettis_LinksOnSuccessPage
.
However, how is it possible the module resulted enabled anyway?
magento module:status
. Furthermore, no pertinent output in exception.log, debug.log, and system.log files.