简体   繁体   中英

Convert update button on cart page from input to an anchor link in Shopify

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 href="#" id="update-cart">Update <i class='fa fa-refresh' aria-hidden='true'></i></a>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM