I am trying to call Template into list.phtml, this file is categories list file, here is the ReferenceBlock and ReferenceContainer code in xml file.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="before.body.end">
        <block class="Devops\DropInCargo\Block\Product\View" name="drop.in.cargo.addtocart.popup" template="Devops_DropInCargo::product/view/addtocart/popup.phtml">
            <block class="Magento\Framework\View\Element\Template" name="pickup.in.cargo.addtocart.popup.areas" template="Devops_DropInCargo::product/view/addtocart/popup/areas.phtml" />
            <block class="Magento\Framework\View\Element\Template" name="pickup.in.store.addtocart.popup.stores.list" template="Convert_PickupInStore::product/view/addtocart/popup/areas-list.phtml" />

        <block class="Devops\DropInCargo\Block\Product\View" name="drop.in.cargo.addtocart.cart" template="Devops_DropInCargo::product/view/addtocart/cart.phtml" />

This is available in


This shows the source in product page of magento 2 at the end before body ends. Now same code i want to show into list.phtml


If I understand you correctly, you want to show your template in the product view page.

Looking at your layout file, you should be calling this:


Hope this helps.


Then you should create new layout file:


with your content.

| improve this answer | |
  • want to call template into product list page ( categories ) – Mr.Devops Apr 29 at 1:07
  • check my update. – Adarsh Khatri Apr 29 at 1:10
  • i did created new layout file with same code from catalog_product_view.xml, but category page went empty, tried it with reducing code as well, but still page goes empty. – Mr.Devops Apr 29 at 2:02
  • I did included template with <?php include ($block->getTemplateFile('Devops_DropInCargo::product/view/addtocart/popup.phtml')); ?> but how to include block with sub and another sub block ? if you see above i did update code! – Mr.Devops Apr 29 at 2:03
  • Check the error logs. You may need to change the blocks in your layout. For ex. Devops\DropInCargo\Block\Product\View class may not be compatible to go to category layout. – Adarsh Khatri Apr 29 at 3:02

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.