Getting Base URL Inside KnockoutJS .html File

<a data-bind="attr: {'href': checkoutConfig.checkoutUrl}" target="_blank">Link</a>

This will redirect to the checkout page by opening a new tab.

<a data-bind="attr: {'href': checkoutConfig.checkoutUrl}">Link</a>

This will redirect to the checkout page without opening a new tab.

Other examples:-

checkout.baseUrl => {www.example.com}/

checkout.checkoutUrl => {www.example.com}/checkout/

checkout.customerLoginUrl => {www.example.com}/customer/account/login/

checkout.removeItemUrl => {www.example.com}/checkout/sidebar/removeItem/

checkout.shoppingCartUrl => {www.example.com}/checkout/cart/

checkout.updateItemQtyUrl => {www.example.com}/checkout/sidebar/updateItemQty/

checkoutConfig.cartUrl => {www.example.com}/checkout/cart/

checkoutConfig.checkoutUrl => {www.example.com}/checkout/

checkoutConfig.defaultSuccessPageUrl => {www.example.com}/checkout/onepage/success/

checkoutConfig.forgotPasswordUrl => {www.example.com}/customer/account/forgotpassword/

checkoutConfig.pageNotFoundUrl => {www.example.com}/checkout/noroute/

checkoutConfig.registerUrl => {www.example.com}/customer/account/create/

checkoutConfig.staticBaseUrl => {www.example.com}/pub/static/

Leave a comment

Your email address will not be published. Required fields are marked *