[object Object]

← back to Designer Wallcoverings

TK-10661: JSON-LD Offer uses first sellable non-Sample variant (theme fix draft, local only, not pushed)

2187851590e890455c53c28f3ffcf804b747ed7b · 2026-08-18 09:07:44 -0700 · Steve Abrams

Files touched

Diff

commit 2187851590e890455c53c28f3ffcf804b747ed7b
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Aug 18 09:07:44 2026 -0700

    TK-10661: JSON-LD Offer uses first sellable non-Sample variant (theme fix draft, local only, not pushed)
---
 .../theme-LIVE-591/snippets/structured-data.liquid | 31 +++++++++++++++++-----
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/shopify/theme-LIVE-591/snippets/structured-data.liquid b/shopify/theme-LIVE-591/snippets/structured-data.liquid
index e9c05679..df7ca2b2 100644
--- a/shopify/theme-LIVE-591/snippets/structured-data.liquid
+++ b/shopify/theme-LIVE-591/snippets/structured-data.liquid
@@ -300,6 +300,23 @@
 
 {% if template contains 'product' %}
   {% assign selected_variant = product.selected_or_first_available_variant | default: product.variants.first %}
+  {%- comment -%}
+    TK-10661: The JSON-LD Offer must reflect the first SELLABLE non-Sample variant, NOT variants[0].
+    On ~62% of DW products the $4.25 "Sample" variant sits in position 0, so
+    selected_or_first_available_variant returns it and Google indexes the premium product as $4.25.
+    Pick the first AVAILABLE non-Sample variant; fall back to the first non-Sample variant;
+    finally fall back to selected_variant (guards a product that somehow has only a Sample).
+  {%- endcomment -%}
+  {%- assign offer_variant = blank -%}
+  {%- for v in product.variants -%}
+    {%- if v.title != 'Sample' and v.available -%}{%- assign offer_variant = v -%}{%- break -%}{%- endif -%}
+  {%- endfor -%}
+  {%- if offer_variant == blank -%}
+    {%- for v in product.variants -%}
+      {%- if v.title != 'Sample' -%}{%- assign offer_variant = v -%}{%- break -%}{%- endif -%}
+    {%- endfor -%}
+  {%- endif -%}
+  {%- if offer_variant == blank -%}{%- assign offer_variant = selected_variant -%}{%- endif -%}
   {% assign product_image = selected_variant.featured_image | default: product.featured_image %}
   {%- capture product_name -%}
     {{ product.title }}
@@ -326,18 +343,18 @@
         "name": {{ product.vendor | json }}
       },
     {% endif %}
-    {% if selected_variant.sku != blank %}
-      "sku": {{ selected_variant.sku | json }},
+    {% if offer_variant.sku != blank %}
+      "sku": {{ offer_variant.sku | json }},
     {% endif %}
-    {% if selected_variant.barcode != blank %}
-      "mpn": {{ selected_variant.barcode | json }},
+    {% if offer_variant.barcode != blank %}
+      "mpn": {{ offer_variant.barcode | json }},
     {% endif %}
     "offers": {
       "@type": "Offer",
       "priceCurrency": {{ cart.currency.iso_code | json }},
-      "price": {{ selected_variant.price | divided_by: 100.0 | json }},
-      "availability": "http://schema.org/{% if selected_variant.available %}InStock{% else %}OutOfStock{% endif %}",
-      "url": "{{ shop.url }}{{ selected_variant.url }}",
+      "price": {{ offer_variant.price | divided_by: 100.0 | json }},
+      "availability": "http://schema.org/{% if offer_variant.available %}InStock{% else %}OutOfStock{% endif %}",
+      "url": "{{ shop.url }}{{ offer_variant.url }}",
       "seller": {
         "@type": "Organization",
         "name": {{ shop.name | json }}

← 4ddc1371 auto-data-snapshot: 2026-08-18T06:39:22 (3 data files) — sho  ·  back to Designer Wallcoverings  ·  TK-10661: use unless idiom (not ==blank) for offer_variant f 7d4c6206 →