Malachyte Portal/Recommend

Adding Rules

How to add rules and conditions to components

Advanced Customization: Adding Rules & Conditions

Components use a Rules β†’ Conditions hierarchy to determine exactly which products surface to your customers.

1. Conditions

A Condition is a single, atomic check against your product catalog.

  • Examples: Price < $50, Category = Jackets, or Margin > 20%.

2. Rules

A Rule acts as a container for one or more Conditions.

  • Conditions within a single Rule can be combined using AND / OR logic.

3. Multiple Rules

Rules themselves can also be combined with AND / OR logic. This flexibility allows you to build everything from simple filters to complex, multi-layer logic trees.


Logic Summary

To help visualize the hierarchy:

  • Condition = Atomic check
  • Rule = Logical group of conditions
  • Multiple Rules = Your full merchandising strategy

Merchandising Controls

Each Rule applies one control type that determines how matching products behave within the strategy.

Control TypeActionBehavior
Only ShowInclusionNarrows eligibility only to products matching the Conditions.
HideExclusionRemoves matching products entirely. Overrides Only Show.
BuryDemoteProducts remain eligible but are ranked lower (Soft demotion).
PromoteBoostProducts remain eligible but are ranked higher (Soft boosting).

Application Scope

These controls can be applied to a wide variety of data points, including:

  • Catalog Attributes: Themes, margins, inventory levels, or star ratings.
  • Specific Identifiers: Individual Product IDs (SKUs).
  • Business Logic: Any custom attribute defined in your product feed.

Note: If a product is targeted by both an Only Show rule and a Hide rule, the Hide rule takes precedence and the product will be removed.

Condition Examples by Attribute

Below are common configurations for applying merchandising logic across different product attributes.

πŸ’° Price & Margin

  • Price
    • Only Show Price < $50 β†’ Only budget products appear.
    • Hide Price > $200 β†’ Luxury items are removed from view.
    • Bury Price > $150 β†’ Higher-priced items sink to the bottom.
    • Promote Price < $40 β†’ Entry-level items rise to the top.
  • Margin
    • Only Show Margin > 20% β†’ Focus exclusively on profitable inventory.
    • Hide Margin < 5% β†’ Automatically remove unprofitable items.
    • Bury Margin < 15% β†’ Reduce visibility for thin-margin products.
    • Promote Margin > 35% β†’ Aggressively boost high-profit items.

🏷️ Collection & Product ID

  • Collection (Taxon)
    • Only Show Taxon = Men’s Jackets
    • Hide Taxon = Clearance
    • Bury Taxon = Accessories
    • Promote Taxon = New Arrivals
  • Product ID (SKU)
    • Only Show Product ID = 123456
    • Hide Product ID = 789101
    • Bury Product ID = 222333
    • Promote Product ID = 999888

✨ Theme

  • Only Show Theme = Summer Collection
  • Hide Theme = Holiday Specials
  • Bury Theme = Flash Sale
  • Promote Theme = Limited Edition

Visual Indicators & Logic Precedence

🎨 UI Color Coding

In the dashboard, rules appear as colored chips to help you quickly identify the logic type:

  • 🟒 Green (Only Show): Strict eligibility gate.
  • πŸ”΄ Red (Hide): Absolute removal from results.
  • 🟠 Orange (Bury): Soft demotion (lower ranking).
  • πŸ”΅ Blue (Promote): Soft boost (higher ranking).

⚑ Precedence Order

Eligibility is always evaluated before ranking. A product must first "survive" the hard gates before any boosting or burying takes effect.

The Processing Pipeline:

  1. Hide (Highest priority β€” if it's hidden, nothing else matters).
  2. Only Show (Filter logic).
  3. Promote / Bury (Final ranking adjustments).

[!IMPORTANT] A product must pass both the Hide and Only Show logic checks before Promote or Bury ranking changes are applied.

Grouping Rules & Conditions β€” Examples

The power of the strategy engine lies in combining multiple rules and conditions. Here is how logic translates to results:

1. Simple AND Rule

  • Rule 1 β€” Only Show
    • Conditions (AND): Category = Women’s Accessories AND Price < $100
  • Result: Only women’s accessories under $100 are eligible.

2. OR Conditions Within One Rule

  • Rule 1 β€” Promote
    • Conditions (OR): Theme = New Arrival OR Margin > 40%
  • Result: Either new arrivals or very high-margin items receive a boost.

3. Multiple Rules with AND (Eligibility + Blocking)

  • Rule 1 β€” Only Show (AND): Category = Men’s Jackets, Price < $180, Inventory > 0
  • Rule 2 β€” Hide (OR): Theme = Clearance, Margin < 8%, Product Rating < 3 Stars
  • Result: Only in-stock men’s jackets under $180 are eligible; however, any items that are clearance, low-margin, or poorly rated are removed entirely.

4. Multiple Rules with OR (Parallel Boost Paths)

  • Rule 1 β€” Promote (AND): Category = Sneakers, Margin > 25%, Inventory > 20 Units
  • OR
  • Rule 2 β€” Promote (AND): Theme = Limited Edition, Price > $120, Launch Date < 30 Days Ago
  • Result: Products only need to satisfy one full Rule to be promoted.

5. Mixed Eligibility + Ranking (Layered Strategy)

This approach separates hard eligibility gates from soft ranking influence.

Rule TypeLogicPurpose
Only ShowPrice < $250 AND Inventory > 0 AND Category β‰  Gift CardsGate: In-stock, affordable items only.
HideMargin < 5% OR Theme = Discontinued OR Product ID IN [111, 222]Block: Removes unprofitable or specific SKUs.
PromoteTheme = New Arrival AND Margin > 30% AND Rating β‰₯ 4 StarsBoost: High-quality new arrivals rise to top.
BuryTheme = Flash Sale OR Inventory < 5 OR Last Updated > 180 DaysDemote: Sinks old or low-stock items.

Saving & Testing

Once you have configured your logic:

  1. Save: The Component will appear in your Component Table.
  2. Validate: Use the Playground (as detailed at the top of this guide) to preview and validate the logic against real data before going live.