Is there a simple solution to add a padlock style icon/image to a button?
Something like the picture.
Solved! Go to the solution
This is an accepted solution.
Hi @Matt_D,
Yes, there is a simple solution to add a padlock style icon/image to a button.
If you have the 'icon-lock' file in your assets directory, you can simply add this code anywhere to get the padlock style icon:
{% include 'icon-lock' %}
For instructions on how to do this on the specific button in your screenshot:
Before you customize your theme:
Edit your theme code:
<input type="submit" name="checkout" class="btn btn--small-wide cart__submit cart__submit-control" value="{{ 'cart.general.checkout' | t }}"/>
<button type="submit" name="checkout" class="btn btn--small-wide cart__submit btn--has-icon-before cart__submit-control" > {% include 'icon-lock' %} {{ 'cart.general.checkout' | t }} </button>
If you don't have the 'icon-lock' file in your assets directory, I can provide that to you.
Let me know if this answers your question or if you need more help!
Brian | Shopify Partner | Ecommerce Consultant
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Need further assistance? Visit www.BrianAtWork.com
Hi @Justyn1304,
@Matt_D is correct that the file should be located in the "Snippets" folder and not the "Assets" folder.
This is contents of the icon-lock.liquid file from the Debut theme:
<svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-lock" viewBox="0 0 17 20"><path fill="#FFF" d="M15.725 8.333H15.3V6.875C15.3 3.02 12.313 0 8.5 0 4.687 0 1.7 3.02 1.7 6.875v1.458h-.425C.571 8.333 0 8.893 0 9.583v9.167C0 19.44.571 20 1.275 20h14.45c.704 0 1.275-.56 1.275-1.25V9.583c0-.69-.571-1.25-1.275-1.25zM4.25 6.875C4.25 4.381 6.077 2.5 8.5 2.5s4.25 1.88 4.25 4.375v1.458h-8.5V6.875zm5.95 8.142c0 .91-.754 1.65-1.683 1.65h-.034c-.93 0-1.683-.74-1.683-1.65v-1.7c0-.911.754-1.65 1.683-1.65h.034c.93 0 1.683.739 1.683 1.65v1.7z"/></svg>
There are CSS styles associated with this icon that need to be added to your theme:
.icon { display: inline-block; width: 20px; height: 20px; vertical-align: middle; fill: currentColor; }
Cheers!
Brian | Shopify Partner | Ecommerce Consultant
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Need further assistance? Visit www.BrianAtWork.com
User | Count |
---|---|
26 | |
20 | |
11 | |
10 | |
10 |