How to add total amount next to checkout letters in the same button on cart drawer

How to add total amount next to checkout letters in the same button on cart drawer

undercoverfresh
Excursionist
138 0 19

Im looking to add the total amount next to the checkout word in the same button on dawn theme 

url knmb1c-pf.myshopify.com

password samurai

 

IMG_7423.jpeg

Reply 1 (1)

Kyle_liu
Shopify Partner
421 53 76

Hi  @undercoverfresh 

Edit theme code, in snippets/cart-drawer.liquid file , edit code,

1.add this:

 

<script>
    document.addEventListener('DOMContentLoaded', function() {
    this.defaultButton = document.getElementsByClassName('cart__checkout-button button');
    if (this.defaultButton.length > 0){
      console.log(this.defaultButton)
      const html = this.defaultButton[0].innerHTML;
      this.defaultButton[0].innerHTML = html+'{{ cart.total_price | money_with_currency }}'
    }
  });
</script>

 

2. remove this:

 

<div class="totals" role="status">
            <h2 class="totals__total">{{ 'sections.cart.estimated_total' | t }}</h2>
            <p class="totals__total-value">{{ cart.total_price | money_with_currency }}</p>
</div>

 

Kyle_liu_0-1739238388041.png

 

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me Email Me Buy Me A Coffee