I found a code to render a block at overview.phtml like code below.


<?php echo $block->getRowItemHtml($_item); ?>

And here's the Overview.php for it.


     * Return row-level item html
     * @param \Magento\Framework\DataObject $item
     * @return string
    public function getRowItemHtml(\Magento\Framework\DataObject $item)
        $type = $this->_getItemType($item);
        $renderer = $this->_getRowItemRenderer($type)->setItem($item);
        return $renderer->toHtml();

     * Retrieve renderer block for row-level item output
     * @param string $type
     * @return \Magento\Framework\View\Element\AbstractBlock
    protected function _getRowItemRenderer($type)
        $renderer = $this->getItemRenderer($type);
        if ($renderer !== $this->getItemRenderer(self::DEFAULT_TYPE)) {
        return $renderer;

And the code from Overview.php is pass to item.phtml for overview page. So my question is, i got data like 'id' that i want to pass to item.phtml from overview.phtml, how can i pass it from the Overview.php?

1 Answer 1


You can pass custom data to item.phtml by using magento magic methods to set data to $_item, like this


<?php $customData = 15 ?>
<?php foreach ($block->getShippingAddressItems($_address) as $_item): ?>
    <?php echo $block->getRowItemHtml($_item->setCustomData($customData));?>
<?php endforeach; ?>


<?php $_item = $block->getItem() ?>
<?php $customData = $_item->getCustomData() ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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