Even the most beautifully designed Shopify store won’t sell if it’s invisible in search results.
With custom SEO code, you can optimize meta titles, descriptions, structured data, and page speed to help Google rank your store higher — all without relying solely on apps.
In this tutorial, we’ll cover key Shopify SEO enhancements using Liquid, JavaScript, and CSS.
🧩 Why SEO Customization Matters
- 🔎 Better Search Rankings: Helps Google understand your products and content.
- 🚀 Faster Pages: Lazy loading improves page speed — a ranking factor.
- 🛍️ Increased Conversions: Rich snippets attract more clicks from search results.
- 📈 Competitive Edge: Custom code allows unique optimization beyond theme defaults.
1️⃣ Dynamic Meta Titles and Descriptions
Make your meta tags unique for each product, collection, and page.
Code Example:
<title>{{ product.title }} | {{ shop.name }}</title>
<meta name="description" content="{{ product.description | strip_html | truncate: 160 }}">
Why It Works:
Custom titles and descriptions improve click-through rate (CTR) in search results.
2️⃣ Structured Data with JSON-LD
Structured data helps Google display rich snippets like product price, availability, and reviews.
Code Example:
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "{{ product.title }}",
"image": ["{{ product.featured_image | img_url: '600x600' }}"],
"description": "{{ product.description | strip_html | truncate: 200 }}",
"sku": "{{ product.variants.first.sku }}",
"offers": {
"@type": "Offer",
"url": "{{ shop.url }}{{ product.url }}",
"priceCurrency": "{{ shop.currency }}",
"price": "{{ product.price | money_without_currency }}",
"availability": "{% if product.available %}InStock{% else %}OutOfStock{% endif %}"
}
}
</script>
Why It Works:
Google can show rich product snippets in search results — increases CTR and visibility.
3️⃣ Lazy Loading Images
Faster page speed is critical for SEO and user experience.
Code Example:
<img src="{{ product.featured_image | img_url: '600x600' }}" loading="lazy" alt="{{ product.title }}">
Why It Works:
Images load only when visible on the screen, improving load time and Google PageSpeed score.
4️⃣ Canonical Tags to Avoid Duplicate Content
Prevents duplicate content issues across product and collection pages.
Code Example:
<link rel="canonical" href="{{ canonical_url }}">
Why It Works:
Signals to Google which page is the main version, protecting SEO rankings.
5️⃣ Alt Text for All Images
Search engines use alt text to understand images and improve image search rankings.
Code Example:
<img src="{{ product.featured_image | img_url: '600x600' }}" alt="{{ product.title }} - {{ product.type }}">
Why It Works:
Boosts SEO and accessibility — Google favors images with descriptive alt tags.
6️⃣ H1, H2, H3 Heading Structure
Organize your content properly for SEO.
Example:
<h1>{{ product.title }}</h1>
<h2>Product Description</h2>
<h3>Specifications</h3>
Why It Works:
Search engines read headings to understand page structure — improves ranking relevance.
7️⃣ Internal Linking with Related Products
Helps search engines crawl your site and improves user navigation.
Code Example:
<h4>Related Products:</h4>
<ul>
{% for related in collections.all.products limit:4 %}
<li><a href="{{ related.url }}">{{ related.title }}</a></li>
{% endfor %}
</ul>
Why It Works:
Boosts SEO through internal linking and increases session duration.
🧠 Pro Tip: Combine All SEO Tweaks
By combining dynamic meta tags, structured data, lazy loading, alt text, and internal linking, your Shopify store becomes both user-friendly and search-engine-friendly.
For packaging stores like Discount Box Printing or Packaging Vista, ensure your product pages have unique descriptions, SKU-specific structured data, and high-quality images with descriptive alt text for every box type.
Previous: Optimize Shopify Cart and Checkout for Higher Conversions
Next: 10 Most Popular Shopify Custom Codes to Upgrade Your Store Design (Recap / Reference)