1

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

asked May 18, 2020 at 13:23

1 Answer 1

2

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

You can find that here:

vendor/magento/module-checkout/view/frontend/templates/cart/item/default.phtml

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

Magento_Checkout/templates/cart/item/default.phtml

answered May 18, 2020 at 23:40
2
  • Thanks, it was what I was looking for, what was your process finding it? Commented May 19, 2020 at 8:44
  • For speed when developing themes I install this: mgt-commerce.com/documentation/magento2-mgt-developer-toolbar This show all the blocks along with the paths to the HTML files used Commented May 19, 2020 at 8:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.