0

in Magento2.2.5 I want to remove the product name and instead where it is load a custom phtml file that will call in a custom product attribute

However my phtml file is not being called in here is my catalog_product_view.xml which I have in my custom design:-

app/design/frontend/vendor/theme/magento_Category/layout

folder

<?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>
    <move element="page.main.title" destination="product.info.main" before="-"/>
    <move element="prev_next_products" destination="product.info.main" before="-"/>
    <move element="product.info.stock.sku" destination="product.info.price" after="product.price.final"/>
    <move element="product.info.review" destination="product.info.main" before="product.info.price"/>
    <move element="product.special.price" destination="product.info.main" after="product.info.price"/>

    <move element="product_view_try_on" destination="product.info.media" before="-"/>
    <referenceBlock name="product.attributes" remove="true" />
    <block class="Magento\Catalog\Block\Product\View" name="product_custom_name" template="Magento_Catalog::product/view/product_custom_name.phtml" before="product.info.price"/>

</body>

  • yo can directly change in title.phtml file , copy the title.phtml file to theme and do the changes you want – Jigs Parmar Jun 29 at 7:17
0

You have put catalog_product_view.xml file in wrong location. You have to put that file in app/design/frontend/your_theme/themename/Magento_Catalog/layout folder. And put custom phtml file in app/design/frontend/your_theme/themename/Magento_Catalog/templates/product/view folder. If still your phtml file not calling then try to add your custom phtml file like following:

<referenceContainer name="content">
       <block class="Magento\Catalog\Block\Product\View" name="product_custom_name" template="Magento_Catalog::product/view/product_custom_name.phtml" before="product.info.price"/>
</referenceContainer>

Hope it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.