Before executing this skill, read these referenced skills with ReadFullDocsArticle:
Creates a discount targeting slow-moving inventory — products with high stock levels and low sales velocity. The discount depth is proportional to how overstocked the product is, with deeper discounts for the most stagnant items. Margin protection guardrails are especially important here since clearance discounts tend to push closer to cost.
getCatalogAnalytics and getProductCatalogData toolsCall getCatalogAnalytics and getProductCatalogData concurrently to assess stock levels and sales velocity.
getCatalogAnalytics call:
getProductCatalogData call:
This sort order surfaces products with the most stock and the fewest sales first — the primary candidates for clearance.
Save the following values:
total_quantity — total stock across catalogtotal_orders — total sales across catalogavg_profit_margin — average profit margin (sets discount ceiling)quantity, ordersCount, price, name, id, categoryIdCalculate the velocity ratio for each product to identify overstocked items:
| Velocity Ratio | Classification | Action |
|---|---|---|
| < 0.1 | Severely overstocked — fewer than 1 sale per 10 units in stock | High priority for clearance discount |
| 0.1 - 0.3 | Moderately overstocked — slow but not stagnant | Medium priority |
| 0.3 - 0.7 | Balanced — reasonable sell-through rate | Not a clearance candidate |
| > 0.7 | Fast-moving — selling well relative to stock | Do NOT discount — unnecessary margin erosion |
Select products with velocity_ratio < 0.3 as clearance candidates.
If quantity = 0 for a product, skip it (nothing to clear). If ordersCount = 0, the velocity ratio is 0 — this is the most urgent clearance case.
Scale the discount based on inventory urgency. Deeper discounts for more overstocked items, constrained by margin:
| Velocity Ratio | Recommended Discount | Rationale |
|---|---|---|
| 0 (zero sales) | 20-25% | Maximum urgency — product is not moving at all |
| < 0.1 | 15-20% | Severely slow — needs aggressive pricing |
| 0.1 - 0.2 | 10-15% | Moderately slow — moderate discount |
| 0.2 - 0.3 | 5-10% | Slightly slow — gentle nudge |
Margin constraint: Always verify discount <= avg_profit_margin - 15% (minMarginPct). Clearance discounts are more likely to violate margin thresholds because they are deliberately deeper.
Global cap: Do not exceed 25% unless the merchant explicitly overrides. For clearance, merchants may accept deeper discounts to free up capital and shelf space.
Select the scope based on the distribution of slow movers:
When selecting ITEMS scope, prioritize the products with the worst velocity ratios (lowest first), up to the max of 5 productIds.
If scope is CATEGORY, call getCategoryIds to convert category names to GUIDs.
IMPORTANT: Run both guardrail checks before creating the discount rule. Clearance discounts are the most likely to trigger margin warnings.
Endpoint: POST https://www.wixapis.com/ecom/v1/discount-rules/query
Request:
This check is especially critical for clearance:
discount_percentage <= avg_profit_margin - 15% for each candidate product.Endpoint: POST https://www.wixapis.com/ecom/v1/discount-rules
Request — 20% off specific slow-moving products:
Response:
Request — clearance on an entire category:
Save the returned id and revision for later management.
active: true"Clearance discount is live: {discount}% off {number_of_products} slow-moving items. These products had a velocity ratio of {avg_velocity}, indicating high stock relative to sales. Monitor inventory levels — once stock clears, consider deactivating the rule."
| Merchant intent | Scope | Discount depth | Notes |
|---|---|---|---|
| "Clear out old inventory" | ITEMS — top 5 slowest movers | Velocity-based (15-25%) | Target worst performers |
| "Clearance sale on winter items" | COLLECTION with category GUID | 15-20% | Category-wide clearance |
| "Get rid of product X" (specific) | SPECIFIC_PRODUCTS with product UUID | 20-25% (user may override) | Single product clearance |
| "Move stale stock across the store" | ITEMS — 5 worst velocity products | Velocity-based | Avoid SITE scope for clearance |
| "25% off these 3 items" (explicit) | SPECIFIC_PRODUCTS | 25% (user override) | Honor explicit request |
| Error | Cause | Fix |
|---|---|---|
DISCOUNT_RULE_NOT_FOUND | Rule ID doesn't exist | Re-query discount rules for current IDs |
REVISION_MISMATCH | Revision doesn't match | Re-fetch rule for latest revision, then retry |
| No slow movers found | All products have healthy velocity ratios (> 0.3) | Inform merchant that inventory is balanced; no clearance needed |
| Margin violation | Discount would push margin below 15% | Reduce discount percentage or get explicit merchant override |
| Quantity data missing | Products lack inventory tracking | Cannot identify slow movers; ask merchant to enable inventory tracking or specify products manually |
| Max items exceeded | More than 5 slow-moving products identified | Select the 5 with worst velocity ratios; consider CATEGORY scope if they share a category |