0

I have created a custom tab in Magento 2 in which the html part is shown by HTML file. Means its extension is (.html).

I want to show some blocks in that html file how would i do that.. Infact i have used php tag and echo something it doesn't work there how to show that data inside php tag?

asked Jul 28, 2020 at 11:42

1 Answer 1

0

PHP does not run in HTML files so you cannot directly do this.

A common but not very clean workaround is to add the HTML from the static block to window.checkoutConfig using PHP and then render that in your HTML file like so:

<div data-bind="html: window.checkoutConfig.yourCmsBlock"></div>
answered Jul 28, 2020 at 16:02
3
  • Thanks for the help, what should i pass in yourCmsBlock because it doesn't work with block ID will you please help @Ben Commented Jul 28, 2020 at 16:19
  • That will be whatever you define it as in your PHP, I'm not a PHP developer so I can't help with that bit sorry. It is explained here magento.stackexchange.com/questions/173324/… and here though - magento.stackexchange.com/questions/157126/… Commented Jul 28, 2020 at 17:20
  • Its okk and Thanks for the Links.Will you Please look into this question. magento.stackexchange.com/questions/318424/… I have removed the discount coupan from checkout page but how would i add in on my custom tab.@BenCook Commented Jul 29, 2020 at 4:52

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.