Skip to main content
Shopify guide

Open Graph for Shopify Stores

By ยท Updated ยท 7 min read

How Shopify Handles Open Graph by Default

Shopify injects a basic set of Open Graph meta tags automatically through its Liquid templating engine. Every storefront running a current Dawn-based or OS 2.0 theme outputs og:title, og:description, og:image, og:url, and og:type on product, collection, blog, and homepage templates without any merchant configuration. This means a freshly launched Shopify store already produces link previews on Facebook, LinkedIn, and similar platforms out of the box.

The default behavior pulls og:title from the product title, og:description from the SEO description field (not the product body HTML), and og:image from the first image in the product's media gallery. If the SEO description field is blank, Shopify falls back to a stripped version of the body HTML โ€” which frequently produces truncated or incoherent preview text. Merchants who leave SEO fields empty get unpredictable social previews.

Where Shopify's Default Open Graph Falls Short

The most common problem is image dimensions. Shopify's default og:image tag points to the original uploaded product image without forcing a specific crop or minimum size. Facebook and LinkedIn require at least 1200ร—630 pixels for a proper link preview. If a merchant uploads portrait-format product photos (taller than wide), the platform crops them arbitrarily and previews look broken.

Shopify also does not output og:image:width and og:image:height attributes by default in most themes. Without these, social crawlers have to fetch the image separately to determine dimensions before rendering the preview, which causes delays or fallback to a plain-text card. Variants present another gap: Shopify's og:image always reflects the first gallery image, not the selected variant's image, so sharing a URL with a ?variant= query string still shows the default product photo.

Collection pages receive minimal Open Graph treatment. The og:description on a collection defaults to the collection's description field, which many merchants leave blank, resulting in previews with no description at all. There is no native og:image for collections unless the theme explicitly references the collection.image Liquid object and that image has been uploaded.

Editing Open Graph Tags Directly in Shopify Themes

The Open Graph markup lives inside snippets/seo.liquid or directly in theme.liquid and the individual template files, depending on the theme. In Dawn (Shopify's reference OS 2.0 theme), Open Graph tags are rendered through snippets/head-content.liquid which calls the global og: assignments. Merchants with developer access can locate the og:image assignment and append the Shopify image URL filter โ€” for example, | image_url: width: 1200 โ€” to force a resized version and then add explicit og:image:width and og:image:height tags with static values.

Directly editing theme code bypasses app logic and survives theme updates only if the merchant uses a duplicated theme or tracks changes in version control. A common pattern is to add a conditional block: if a product has a metafield containing a custom social image, use that; otherwise fall back to the resized first gallery image. Shopify metafields (available natively since 2021) make this workflow cleaner without requiring a third-party app.

Apps and Tools That Extend Open Graph on Shopify

The Shopify App Store includes SEO-focused apps โ€” such as SEO Manager, Plug in SEO, and Smart SEO โ€” that add UI controls for editing og:title and og:description per product, collection, and page without touching code. These apps write their overrides either into metafields that the theme reads, or by injecting script tags into the storefront head. The injection method is less reliable because it depends on JavaScript executing before social crawlers read the page, and most social crawlers do not execute JavaScript.

Apps that write to metafields and require a matching theme snippet are the more durable architecture. Before installing any SEO app, check whether its Open Graph output method is metafield-based or script-injection-based โ€” the product documentation or support team should answer this directly. Duplicate Open Graph tags (one from the theme, one from an app) cause crawlers to use the first instance encountered, which is usually the theme's default, making the app override ineffective.

For stores running headless Shopify (Hydrogen or a custom React/Next.js frontend), Open Graph tags are the developer's full responsibility. The Storefront API returns product data but does not generate meta tags. Developers must implement og: tags in the HTML head of each route using the fetched product or collection data.

Fixing Variant-Level and Dynamic Open Graph on Shopify

Shopify does not natively support variant-specific Open Graph images because og: tags are rendered server-side at page load, not updated when a user selects a variant on the client side. The URL structure for variant pages (/products/handle?variant=ID) does trigger a separate server render on Shopify's infrastructure, so the og:image tag can technically reference the variant's image if the Liquid template is written to detect the variant parameter.

The implementation requires reading the url.search Liquid object or parsing the variant parameter in the template, then looking up that variant's featured_image property and outputting it as the og:image value. This is a code-level customization not available through the Shopify admin UI. Merchants without developer resources should at minimum ensure the first product image (which becomes the default og:image) is in landscape format at 1200ร—630 or larger, so default previews always render correctly regardless of variant selection.

Actionable Priorities for Shopify Open Graph

Start with an audit using Facebook's Sharing Debugger tool (developers.facebook.com/tools/debug), which shows exactly what tags Shopify is serving for any URL and highlights missing or undersized images. Run the debugger on the homepage, one product page, one collection page, and one blog post to get a cross-template view of the current state.

Then prioritize in this order: fill in the SEO description field on all published products and collections (this is the single highest-return task requiring no code); ensure the first product image for every product is landscape at 1200ร—630 minimum; add og:image:width and og:image:height to the theme snippet; and test again with the debugger. These four steps resolve the majority of broken social previews on Shopify stores without requiring an app or headless architecture.

Frequently asked questions

Does Shopify automatically add Open Graph tags to product pages?

Yes. All themes based on Shopify's OS 2.0 architecture โ€” including Dawn โ€” output og:title, og:description, og:image, og:url, and og:type on product pages without any configuration. The og:description pulls from the SEO description field in the product editor. If that field is blank, the output is unpredictable. Older themes may have incomplete implementations that require manual code edits.

Why does my Shopify product show the wrong image when shared on Facebook?

Facebook reads the og:image tag, which Shopify sets to the first image in the product's media gallery. If that image is portrait-oriented or smaller than 1200ร—630 pixels, Facebook crops or skips it. Use Facebook's Sharing Debugger to see exactly which image URL Shopify is outputting, then either reorder product images or edit the theme snippet to force a landscape-cropped version using Shopify's image_url filter.

Can I set different Open Graph images for each Shopify product without coding?

Some SEO apps in the Shopify App Store provide a per-product og:image override field. However, check that the app writes its value to a metafield read by the theme, not via JavaScript injection. Script-injection methods fail with social crawlers because those crawlers do not execute JavaScript. Native Shopify metafields paired with a theme snippet edit is the reliable no-app alternative.

Do Shopify collection pages get Open Graph tags?

Most Shopify themes output basic Open Graph tags on collection pages, but the og:image is empty unless a collection image has been uploaded in the admin and the theme references the collection.image Liquid object. The og:description defaults to the collection description field, which many stores leave blank. Both should be filled in explicitly to avoid plain-text link previews when collection URLs are shared.

Does a headless Shopify store using Hydrogen handle Open Graph automatically?

No. Hydrogen and other headless Shopify frontends give developers full control of the HTML head, which means Open Graph tags are entirely the developer's responsibility. The Storefront API returns product and collection data but does not generate meta tags. Each route in the frontend application must explicitly construct and render the relevant og: tags using fetched data before the response is sent to the client.

MG
Written by

Matt is the founder of RunOctopus. He built All Angles Creatures from zero to page-1 rankings in reptile feeder insects in under 60 days using exactly this method โ€” turning a hard, entrenched niche into RunOctopus's proof store for programmatic SEO and AI search citation.

Connect on LinkedIn →

See what Otto would build for your store

Free architecture preview. No card required. Five minutes.

Generate Preview →