Fix image-alt in Shopify Liquid
Shopify product grids and custom Liquid banners routinely trigger critical image-alt failures when merchants upload media without alt text or when Liquid templates omit the alt attribute entirely. Using Shopify's image_url | image_tag filter with a clean fallback (media.alt | default: product.title | escape) guarantees every product image exposes meaningful text.
Before and after
{%- comment -%} snippets/card-product.liquid (Broken: missing alt attribute) {%- endcomment -%}
<img
src="{{ card_product.featured_media | image_url: width: 600 }}"
width="600"
height="600"
loading="lazy"
class="card__media-img"
>{%- comment -%} snippets/card-product.liquid (Fixed: explicit alt with safe Liquid fallback) {%- endcomment -%}
{%- assign image_alt = card_product.featured_media.alt | default: card_product.title | escape -%}
{{
card_product.featured_media
| image_url: width: 600
| image_tag:
alt: image_alt,
loading: 'lazy',
widths: '300, 450, 600',
sizes: '(min-width: 990px) 25vw, 50vw',
class: 'card__media-img'
}}Fixed vs. broken example
Always provide meaningful alt text for informative photos and explicitly set alt="" (empty string) for purely decorative flourishes so screen readers skip them cleanly.
Playwright + axe-core check
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
test("Shopify collection grid product images expose non-empty alt text", async ({ page }) => {
await page.goto("/collections/all");
const results = await new AxeBuilder({ page })
.withRules(["image-alt"])
.analyze();
expect(results.violations).toEqual([]);
});Template deduplication tip
Missing alt attributes inside snippets/card-product.liquid or sections/main-collection-product-grid.liquid repeat across every SKU card on every /collections/* and /products/* page. A11yDrift clusters thousands of missing-alt alerts into that single Liquid card snippet.
What NVDA and VoiceOver announce
When an informative image lacks an alt attribute, screen readers either skip it silently or read out raw CDN filenames and hashes, blocking blind shoppers and readers from understanding products, charts, and editorial photos.
NVDA (Windows)
"graphic, cdn_shop_files_IMG_8842_v1731942.webp" (or skipped silently depending on verbosity)
"Cobalt blue stoneware ceramic pour-over mug with matte handle, graphic"
VoiceOver (macOS / iOS)
"IMG_8842_v1731942.webp, image"
"Cobalt blue stoneware ceramic pour-over mug with matte handle, image"
Common questions
When should a Shopify Liquid image use alt="" instead of descriptive text?
Does Shopify's image_tag filter automatically output an alt attribute?
Should product card alt text repeat the exact link title right next to it?
Test a URL for image-alt
Enter any public URL for a free WCAG 2.2 AA check—no account or credit card required.
Managing Shopify Liquid client sites? Monitor 15 sites on one flat plan with white-label portals and branded executive PDFs—$1,140/yr ($95/mo billed annually, 24-month rate lock + onboarding) for Founding 10 agencies.