I have made a custom Block that appears on the checkout page of every product item. So each time the product is rendered, that block is called.enter image description here The block is rendered below every product item. I want to get the current product id on which the block is trying to render in a phtml file. So if I can get the current product id of that item, I can check some conditions and render that block based on those conditions. So it will not render on all products on the checkout page.

How can I achieve that?

  • Please share your Block, Layout and phtml file here for a better answer.
    – Msquare
    Commented Aug 25, 2022 at 10:36

1 Answer 1


This answer worked for me. I overrode the default.phtml file with my logic and it worked as I wanted.

This is the link to the answer I followed. https://magento.stackexchange.com/a/212004/108564

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.