2

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

  • For which template are you looking for url? – Rakesh Jesadiya May 31 '17 at 7:00
  • i want to get store url in checkout/web/template – Waqar May 31 '17 at 7:33
  • Have you define js file for respective HTML template? – Rakesh Jesadiya May 31 '17 at 8:45
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>
1

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

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.