1

I'm trying to make the "view and edit cart" link at the bottom of the mini cart a button.

Magento 2.1.10 MiniCart View and Edit Cart Link

I have copied content.html to my child theme

app/design/frontend/Mytheme/Mytheme/Magento_Checkout/web/template/minicart/content.html

Within content.html the "View and edit cart" link is generated from

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

I have changed it to

    <div class="actions">
       <div class="secondary">
                 <button
                    id="lower-cart-btn-checkout"
                    type="button"
                    class="action viewcart"
                    data-bind="attr: {href: shoppingCartUrl}">
                <!-- ko i18n: 'View and Edit Cart' --><!-- /ko -->
            </button>
    </div>
</div>

The button is generated. However, when you click the button nothing happens. Magento 2.1.10 MiniCart View and Edit Cart Button

Does anyone know what I'm doing wrong here?

2 Answers 2

2

It should always be <a> tag (link). Add whatever class you want and convert that link into Button using CSS

data-bind="attr: {href: shoppingCartUrl}" attribute will NOT work with <button> Tag

<!-- ko if: getCartParam('summary_count') -->
<div class="actions">
    <div class="secondary">
        <a id="minicart-to-editcart" class="button action viewcart" data-bind="attr: {href: shoppingCartUrl}">
            <span><!-- ko i18n: 'View and edit cart' --><!-- /ko --></span>
        </a>
    </div>
</div>
<!-- /ko -->
0
0
<div class="secondary">
     <a class="action btn btn-default btn-full margin-bottom15" href="https://www.testdomain.com/en/categories">      
     <span><!-- ko i18n: 'Continue Shopping' --><!-- /ko --></span>
     </a>
</div>

I have a Category page https://www.testdomain.com/categories.

How can i get this in attribute format in minicart html.

The Above Link not working.I have english and arabic Store.

Thanks

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.