Element 'body' : Character content other than whitespace is not allowed because the content is 'element-only' after Magento 2.3.4 upgrade
-
11-04-2021 - |
문제
After Magento 2.3.4 upgrade, Error is "Element 'body' : Character content other than whitespace is not allowed because the content is 'element-only'" on Product details page.
Actually after removing below code from app/code/Vendor/Module/view/layout/catalog_product_view.xml file it's resolved.
<?xml version="1.0"?>
<page layout="1column" 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.addtocart">
<action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Module::catalog/product/view/addtocart.phtml</argument>
</action>
</referenceBlock>
<referenceBlock name="product.info.addtocart.additional">
<action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Module::catalog/product/view/addtocart.phtml</argument>
</action>
</referenceBlock> ---->
</body>
</page>
Now i am looking for rectification of this code because it was working fine in Magento 2.2.4 version but not in Magento 2.3.4
If anyone having an idea please guide me. Thanks in Advance !!.
해결책
Below code worked perfectly fine.
<?xml version="1.0"?>
<page layout="1column" 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.addtocart" template="Vendor_Module::catalog/product/view/addtocart.phtml"/>
<referenceBlock name="product.info.addtocart.additional" template="Vendor_Module::catalog/product/view/addtocart.phtml"/>
</body>
</page>
다른 팁
I think setTemplate is not used in Magento 2.3.4 you double check with that.
Try with below code
<referenceBlock name="product.info.addtocart">
<arguments>
<argument name="template" xsi:type="string">Vendor_Module::catalog/product/view/addtocart.phtml</argument>
</arguments>
</referenceBlock>
<referenceBlock name="product.info.addtocart.additional">
<arguments>
<argument name="template" xsi:type="string">Vendor_Module::catalog/product/view/addtocart.phtml</argument>
</arguments>
</referenceBlock>
제휴하지 않습니다 magento.stackexchange