[object Object]

← back to Designer Wallcoverings

dw-vendor-collection-url: use collection.id existence test + unless-chain (robust over == empty)

caa2d35e3c6ef9543490e8f105e66711e99da176 · 2026-06-23 12:03:38 -0700 · Steve Abrams

Files touched

Diff

commit caa2d35e3c6ef9543490e8f105e66711e99da176
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Jun 23 12:03:38 2026 -0700

    dw-vendor-collection-url: use collection.id existence test + unless-chain (robust over == empty)
---
 .../_cwGRID/snippets/dw-vendor-collection-url.liquid   | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/shopify/_cwGRID/snippets/dw-vendor-collection-url.liquid b/shopify/_cwGRID/snippets/dw-vendor-collection-url.liquid
index 58a6c5b8..a8ec8491 100644
--- a/shopify/_cwGRID/snippets/dw-vendor-collection-url.liquid
+++ b/shopify/_cwGRID/snippets/dw-vendor-collection-url.liquid
@@ -12,22 +12,26 @@
     3. collections[handleize(vendor)-1]                 (Shopify dup suffix)
     4. product.vendor | url_for_vendor                  (original search URL)
 
+  Existence test uses `collection.id` — Shopify returns an EMPTY collection
+  drop (id == nil) for a missing handle, so `collections[h] == empty` is
+  unreliable; `.id` is the robust truthiness check.
+
   Usage:
-    {% render 'dw-vendor-collection-url', vendor: product.vendor %}
-  Returns the URL as inline output (assign-and-capture at the call site).
+    {% capture u %}{% render 'dw-vendor-collection-url', vendor: product.vendor %}{% endcapture %}
+    <a href="{{ u | strip }}">…</a>
 {% endcomment %}
 {%- liquid
   assign _vh = vendor | handleize
   assign _col = collections[_vh]
-  if _col == empty or _col.url == blank
+  unless _col.id
     assign _vh2 = _vh | append: '-wallcoverings'
     assign _col = collections[_vh2]
-  endif
-  if _col == empty or _col.url == blank
+  endunless
+  unless _col.id
     assign _vh3 = _vh | append: '-1'
     assign _col = collections[_vh3]
-  endif
-  if _col != empty and _col.url != blank
+  endunless
+  if _col.id and _col.url != blank
     echo _col.url
   else
     echo vendor | url_for_vendor

← f0d8c26f Add Tres Tintas final completeness audit (desc/specs-by-type  ·  back to Designer Wallcoverings  ·  Add gated live-push + rollback scripts + candidate snapshot 72762a60 →