I've created a custom footer template inside my theme folder app/design/Vendor/Module/Magento_Email/email/footer.html , the problem is i need to get base url inside this html file.

  • You can setup the url using js file.

First of all add mage/url to the list of dependencies. Then add the below function to your js file.

getBaseUrl: function() {
    return url.build('<your_url_path>');

Then use the knockout to set href

<a data-bind="attr: { href: getBaseUrl() }">Add Some Text</a>

Then must clear the varnish and browser cache and check

  • @IdhamChoudry please upvote answer if it's useful for you. So, other can use this answer. – Emipro Technologies Pvt. Ltd. Apr 5 '18 at 11:19
  • Huh, this question is about email templates, not knockout html templates and ui component view models... Or am I misinterpreting this? – Erfan May 2 '18 at 8:43
  • How is this the selected answer? This has nothing to do with email templates – Gezzasa May 13 '20 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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