I am trying to change de default product stock availability text to my own by using a custom phtml file. I want to overwrite "module-catalog/view/frontend/templates/product/view/type/default.phtml" therefore I created a custom module with catalog_product_view.xml with the following contents:
<?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="product.info.type">
<block class="Magento\Catalog\Block\Product\View\Type\Simple" name="product.info.description" as="product_type_data" template="Sixways_Estdelivery::displayStockStatus.phtml">
<argument name="cacheable" xsi:type="boolean">false</argument>
</block>
</referenceContainer>
</body>
This works great but the exception.log file is filling up with this error:
main.CRITICAL: Magento\Framework\Exception\LocalizedException: The element 'product.info.type' already has a child with alias 'product_type_data' in /staging/vendor/magento/framework/Data/Structure.php:611
I tried leaving product_type_data
away but that makes the original and the custom phtml appear instead of only the custom one.
What is the correct way of overwriting name="product.info.simple" as="product_type_data"
in referenceContainer name="product.info.type"
?