SVG Icon: How to use svg icon in shopify store
In the world of e-commerce, where first impressions are everything, utilizing an SVG icon strategy is crucial for a professional and user-friendly online store. Crisp, scalable icons are vital. If you're building a Shopify site, especially when translating beautiful designs from Figma, you'll constantly work with SVG Icon (Scalable Vector Graphics) files. But what’s the best way to get them onto your store?
Let's explore two simple, effective methods for using SVGs in Shopify, focusing on how they impact your site's look and performance.
Why SVGs? A Quick Refresh
Before we dive into the "how," a quick reminder of "why":
Scalable: SVGs look perfect on any screen size, from a phone to a giant monitor, without getting blurry.
Lightweight: They're often smaller in file size than traditional image formats.
Editable: You can easily change their colors and styles with CSS.
Now, let’s get those icons onto your Shopify theme!
Method 1: The Direct Paste (Copy & Paste Simplicity)
This is the most straightforward approach, perfect for unique icons or when you only need an SVG Icon in one specific spot.
How it works:
You simply copy the SVG code directly from your design tool (like Figma) or an SVG editor and paste it right into your Shopify theme's HTML (.liquid file).
Example:
<span><svg width="16" height="13" viewBox="0 0 16 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.75 6.375H14.5M14.5 6.375L8.875 0.75M14.5 6.375L8.875 12" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></span>