Ad

Convert Update Button On Cart Page From Input To An Anchor Link In Shopify

- 1 answer

On the cart page in Shopify I'd like to use an anchor link instead of an input button when user updates cart so that I can add an html icon using Font Awesome. I don't believe I can accomplish with a button.

Here's the current button:

<input type="submit" id="update-cart" class="btn" name="update" value="{{ 'cart.general.update' | t }}" style="float:right;"/>

I tried the following with no luck:

<a target="_blank" rel="nofollow noreferrer" href="#" id="update-cart">Update <i class='fa fa-refresh' aria-hidden='true'></i></a>
Ad

Answer

A button would definitely be the best solution here. I'm not sure why you believe it wouldn't work. Try this:

<button id="update-cart" class="btn" name="update" style="float: right;">
  {{ 'cart.general.update' | t }}
  <i class="fa fa-refresh" aria-hidden="true"></i>
</button>

Note that you should really add that inline style via a rule in an external stylesheet.

Ad
source: stackoverflow.com
Ad