[object Object]

← back to Dw Theme Boost Fix

fix: use first non-Sample variant for JSON-LD offer price (TK-10678)

351da74998d9fb37f09898070e3e9ee331c9addc · 2026-08-25 04:15:59 -0700 · Steve Abrams

selected_or_first_available_variant can resolve to the $4.25 Sample
variant, causing Google Merchant Center to index $4.25 as the roll price.
Assign offer_variant = first variant where title != 'Sample' so the
JSON-LD Offer always shows the real roll price.
Push to live via PUSH-live.sh remains gated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files touched

Diff

commit 351da74998d9fb37f09898070e3e9ee331c9addc
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Aug 25 04:15:59 2026 -0700

    fix: use first non-Sample variant for JSON-LD offer price (TK-10678)
    
    selected_or_first_available_variant can resolve to the $4.25 Sample
    variant, causing Google Merchant Center to index $4.25 as the roll price.
    Assign offer_variant = first variant where title != 'Sample' so the
    JSON-LD Offer always shows the real roll price.
    Push to live via PUSH-live.sh remains gated.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
 snippets/structured-data.liquid | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/snippets/structured-data.liquid b/snippets/structured-data.liquid
index e9c0567..4cbfa84 100644
--- a/snippets/structured-data.liquid
+++ b/snippets/structured-data.liquid
@@ -301,6 +301,19 @@
 {% if template contains 'product' %}
   {% assign selected_variant = product.selected_or_first_available_variant | default: product.variants.first %}
   {% assign product_image = selected_variant.featured_image | default: product.featured_image %}
+
+  {%- comment -%}
+    Use the first non-Sample variant for the JSON-LD offer price.
+    Without this, selected_or_first_available_variant can resolve to the $4.25
+    Sample variant, causing Google to index $4.25 as the roll price (TK-10678).
+  {%- endcomment -%}
+  {%- assign offer_variant = nil -%}
+  {%- for v in product.variants -%}
+    {%- if offer_variant == nil and v.title != 'Sample' -%}
+      {%- assign offer_variant = v -%}
+    {%- endif -%}
+  {%- endfor -%}
+  {%- if offer_variant == nil -%}{%- assign offer_variant = selected_variant -%}{%- endif -%}
   {%- capture product_name -%}
     {{ product.title }}
     {%- if selected_variant.title != 'Default Title' and selected_variant.option1 == 'Default Title' -%}
@@ -335,9 +348,9 @@
     "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 }}

← 2e45e29 TK-10629: de-leak Versa Designed Surfaces -> Hollywood Contr  ·  back to Dw Theme Boost Fix  ·  TK-10835: persist infinite scroll on deep ?page=N landings ( 2b6da47 →