2

i want to get cart url in Knockout HTML template magento 2

3
  • For which template are you looking for url? May 31, 2017 at 7:00
  • i want to get store url in checkout/web/template
    – Waqar
    May 31, 2017 at 7:33
  • Have you define js file for respective HTML template? May 31, 2017 at 8:45

2 Answers 2

3

Here are the relevant parts:

checkout.baseUrl
checkout.checkoutUrl
checkout.customerLoginUrl
checkout.removeItemUrl
checkout.shoppingCartUrl
checkout.updateItemQtyUrl

checkoutConfig.cartUrl
checkoutConfig.checkoutUrl
checkoutConfig.defaultSuccessPageUrl
checkoutConfig.forgotPasswordUrl
checkoutConfig.pageNotFoundUrl
checkoutConfig.registerUrl
checkoutConfig.staticBaseUrl

Reference : Best Way Of Getting Base URL Inside KnockoutJS .html File

1

See below code to get Cart url in Knockout HTML template in Magento2 shoppingCartUrl

See below example link to Cart page.

<a class="action viewcart" data-bind="attr: {href: shoppingCartUrl}">
    <span><!-- ko i18n: 'View Cart' --><!-- /ko --></span
</a>

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.