← back to Elitis Price 2026

exec/find_ref.py

27 lines

import json, sys
sys.path.insert(0,'exec/lib')
from shopify import gql

# Find ACTIVE products that have a Sample variant AND a non-sample sellable variant,
# to learn the canonical sample+sellable modeling. Try a few known priced vendors.
Q="""query($q:String!){ products(first:15, query:$q){ edges{ node{
  title vendor status
  options{name values}
  variants(first:15){ edges{ node{ title sku price inventoryPolicy inventoryItem{tracked}
    selectedOptions{name value} } } }
} } } }"""

for vendor in ["Thibaut","Novasuede","Phillipe Romano","Maya Romanoff"]:
    d=gql(Q,{"q":f'vendor:"{vendor}" status:active'})
    for e in d["products"]["edges"]:
        n=e["node"]
        vs=[v["node"] for v in n["variants"]["edges"]]
        has_sample=any((x["sku"] or "").endswith("-Sample") or x["title"]=="Sample" for x in vs)
        has_sell=any(not((x["sku"] or "").endswith("-Sample")) and x["title"]!="Sample" for x in vs)
        if has_sample and has_sell and len(vs)>=2:
            print(f"\n### {vendor}: {n['title']}")
            print("  options:", n["options"])
            for x in vs:
                print(f"   - sku={x['sku']!r} title={x['title']!r} price={x['price']} policy={x['inventoryPolicy']} tracked={x['inventoryItem']['tracked']} opts={x['selectedOptions']}")
            break