Rules and Scopes
Target the right products with the right thresholds and actions
A rule ties a scope (what to target) to thresholds (when it's at risk) and an action (what to do about it).
Anatomy of a rule
{
name: "Winter Coats - Aggressive Clearance"
scopeType: "collection"
scopeValue: "gid://shopify/Collection/123"
warningDays: 14
dangerDays: 30
deadDays: 45
autoAction: "40% Off Clearance"
}
The 8 scope types
Ordered from highest priority (most specific) to lowest:
Product (priority 100)
Target a single product by Shopify GID. Use for one-off treatments — e.g. "always keep this hero product at full price".
Tag (priority 80)
Target every product carrying a specific tag. Powerful for cross-collection campaigns (seasonal, bundle-bait).
Collection (priority 60)
Target every product in a Shopify smart or manual collection. Best for category-wide policies.
Product type (priority 40)
Target by Shopify's built-in productType field. Use for broad categories like Shoes, Outerwear.
Vendor (priority 20)
Target by vendor. Use when a supplier's products consistently sell faster or slower than your average.
Category (priority 15)
Target by Shopify's product taxonomy node (e.g. "Apparel > Tops > T-Shirts"). Hierarchical.
SKU prefix (priority 10)
Target by SKU prefix (everything before the first -). Useful when your SKU encodes the season or product family.
Location (priority 5)
Target by inventory location. Use to clear out a single warehouse or pop-up.
How matching works
When Shelfie analyses a product, it walks every active rule, picks the ones whose scope matches, and applies the highest-priority matching rule. Ties broken by priority field (higher wins), then by createdAt (older wins).
The catch-all rule (no scope) sits at priority 0 — it matches every product and is the fallback.
See Rule Priority for the full resolution algorithm and tie-breaking.
Best practices
- Start with the catch-all — set sensible global defaults before adding specific rules
- Layer specificity — vendor rule for broad coverage, tag rule for campaigns, product rule for exceptions
- Re-use actions — multiple rules can share one action (e.g. "30% Off Markdown" used by 5 rules)
- Name rules clearly — "Nike SS24 Clearance" beats "Rule 7"
- Audit regularly — products move between collections; rules can become stale