How to get image url in knockout html template Magento 2?

You can add or get an image URL to .html (knockout) template to show images at a specific location in the checkout page of Magento 2.

In .html file, if you want to set a dynamic image from the theme or module’s web folder in the checkout page or any location that contains code render as knockout, You can be assigned images using the knockout template with ease. Continue reading “How to get image url in knockout html template Magento 2?”

How to set Price Format using javascript Magento 2.

Format a Price Using Javascript(JS) in Magento 2 to display a price with proper formatting.

You have to use ‘Magento_Catalog/js/price-utils’ priceUtils Js Object in your javascript file to set format a price using javascript. Continue reading “How to set Price Format using javascript Magento 2.”

How to get Custom, Base URL in JS file Magento 2?

You can get the custom or base URL of the store in a javascript(JS) file for the frontend area using the 'mage/url' widgets.

You have to pass the 'mage/url' widget as a dependency in a define([]) or require([]) function of the javascript file. Continue reading “How to get Custom, Base URL in JS file Magento 2?”