Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

magento 2 block called as child pass product variable

<?php /* Start Custom Changes */ ?>
<?php if ($myBlock = $block->getChildBlock('my_child_block')): ?>
    <?php
        $myBlock->setProduct($_product); 
        echo $block->getChildHtml('my_child_block', false);
    ?>
<?php endif; ?>
<?php /* End Custom Changes */ ?>
Source by magento.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #magento #block #called #child #pass #product #variable
ADD COMMENT
Topic
Name
6+3 =