4

We want to add proceed to checkout button

on product detail page.

We will show this checkout button when cart have items

otherwise we will remove this.

See this : http://www.awesomescreenshot.com/image/1702035/4335f469aee99eb7375a9fdeb7d2f22e

2

Got Solutions:

<div class="cart-section" data-bind="scope: 'minicart_content'" >
 <!-- ko if: getCartParam('summary_count') -->
 <a href="<?php echo $this->getUrl('checkout/cart'); ?>" class="checkout-btn"><?php echo __('Checkout'); ?></a>
 <!-- /ko -->

scope: 'minicart_content' will provide all scope values
that is why <!-- ko if: getCartParam('summary_count') --> is working

1
  • We just need to define scope & then we will be able to use binding any where in magento 2 Oct 12 '16 at 9:29
1
> <script type="text/javascript">
>     require(['jquery', 
>             'yourjs'], function ($) {
>         (function () {
>         //write your code here 
>         })(jQuery);
>     }); </script>

you can use your require js parameters in yourjs try this :)

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.