Can I customise only product details page without creating any child theme? I just want to modify the product image on the detail page.

  • Which theme are you using? Do you want edit product image size or js or template? – xanka Oct 15 '20 at 10:19
  • I am using default Luma theme. I want to edit the image and add few codes of Js/jQuery. – VishalParkash Oct 15 '20 at 10:55
  • add new file in app/design/frontend/Magento/Luma/vendor_module/templates/path file in template of your module – Thành Trung Tô Oct 15 '20 at 11:50
  • @VishalParkash you can create new folder in ../app/design/frontend/Magento/luma/Catalog/... just follow base on magento code module. I think some answer below is help you. – xanka Oct 16 '20 at 11:02


<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="content">
        <block class="Magento\Catalog\Block\Product\View" name="product.view.customdetail" template="Vendor_Extension::customdetailpage.phtml" before="-"/>
    <referenceContainer name="product.info.main" remove="true"></referenceContainer>
    <referenceContainer name="product.info.media" remove="true"></referenceContainer>
    <referenceContainer name="product.info.details" remove="true"></referenceContainer>
    <referenceBlock name="page.main.title" remove="true" />


<?php $product = $block->getProduct(); ?>
<?php echo $product->getName();?> <!-- add your code as per your need-->

Create the catalog_product_view.xml file in your module, path:app/code/{VendorName}/{PackageName}/view/frontend/layout

And do your customization.


It depends on your needs but anyway, I would recommend you to create a child theme as soon as you want to alter the default template. Create a child theme is quite straightforward, and it allows you to keep your modification in place even when you will upgrade your magento 2 version.

  • So, that means there is no other way to change the single default page.? – VishalParkash Oct 15 '20 at 11:02
  • You can change the default page by modifying the default page in the code, but it's not recommended because you might lose your work as soon as you upgrade magento. After you can try what Thành Trung Tô said in a comment above. It should work – Sony Oct 15 '20 at 13:32

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.