I'm overriding the file Magento_Checkout/templates/cart/form.phtml, I stumbled upon some php code generating html code which I can't find its origin

Here is the code

<?php foreach ($block->getItems() as $_item) :?>
   <?= $block->getItemHtml($_item) ?>
<?php endforeach ?>

So my goal is to change the html output of the function getItemHtml, the block handling the template is @var $block \Magento\Checkout\Block\Cart\Grid

I don't understand how does it works, I guess it's not hard coded and we can change a layout which handle this?

Thanks for reading

1 Answer 1


Are you just looking for the file which holds the HTML for each item rendered in that foreach list?

You can find that here:


You can create a version of this in your theme for your custom HTML here:



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.