I've got a custom Magento 2 module that is causing issues on newly created products. All of the existing ones seem to be okay. I'm running Magento 2.3.4
in my template: /app/design/frontend/MySite/MyTheme/Magento_Catalog/templates/product/view/attributes.phtml
<?php
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_product = $block->getProduct()
?>
$block->getChildBlock("myblock")->setData("my_data", $_product);
echo $block->getChildHtml('myblock', false);
The line that reads $block->getChildBlock("MyBlock")->setData("my_data", $_product); is throwing the following error:
PHP Fatal error: Uncaught Error: Call to a member function setData() on boolean in /var/www/mysite.com/app/design/frontend/MySite/MyTheme/Magento_Catalog/templates/product/view/attributes.phtml
Any idea why this would work for all products but newly added ones? The contents of the block being referenced are irrelevant at this point as it's not making it far enough to load it.
Edited to add XML (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>
<move element="product.attributes" destination="product.info.price" after="-"/>
<referenceBlock name="product.attributes">
<block class="Catalog\MyBlock\Block\Catalog\Product\Myblock" name="catalogmyblock" as="myblock" template="Catalog_MyBlock::view/myblock.phtml">
</block>
</referenceBlock>
<!-- <referenceContainer name="product.info.price" remove="true"/> -->
<referenceContainer name="product.info.addtocart" remove="true"/>
</body>
</page>