Shample Intel
Menu
Catalog quality guide

Make zero-stock removal an explicit, reviewable option

Compare zero, positive and blank quantities and reproduce optional zero-stock filtering without treating missing values as zero.

Review and exportUpdated Guide slug: filter-zero-stock-without-dropping-unknowns

The issue to look for

Blank stock can mean unknown, not sold out. A broad falsy-value filter can silently delete both zero-quantity rows and rows that need supplier clarification.

What this check can tell you

The fixture enables removeZeroStock and proves that only the numeric-zero row disappears. The blank row remains and is counted as an invalid quantity.

A transparent review

  1. Run the file with the default filter disabled and retain all three records.
  2. Enable removeZeroStock and compare the two retained records with the original.
  3. Inspect the unknown-stock finding separately from the zero-stock count.
  4. Use a separate source-confirmed rule for blanks rather than interpreting them as unavailable.

How to read the result

  • Quantity validation accepts non-negative whole-number text. Zero is a valid quantity, whereas an empty field is invalid/unknown. The removal option tests for numeric zero specifically.
  • Summary counts describe the analyzed input as well as removals: totalRows remains three, zeroStockRows is one, removedRows is one, and retainedRows is two. A successful parse does not establish that current availability is fresh.

Limits to keep in view

  • Filtering is off by default and changes exported row counts.
  • The tool does not fetch live stock or interpret supplier allocation rules.
  • Missing quantity columns are reported separately rather than assumed to contain zeros.
Illustrative sample

Synthetic fixture: synthetic-zero-stock.csv

This small synthetic example makes the transformation and observation visible. It is an educational illustration, not a claim that a supplier file or external registry was verified.

Fixture ID
zero-stock
Published fixture reference
zero-stock
Filename
synthetic-zero-stock.csv
Encoding
UTF-8
Options
{"removeZeroStock":true}

Input

SKU,Qty,Cost
STOCK-0,0,3.00
STOCK-4,4,3.00
STOCK-UNKNOWN,,3.00

Output

{
  "checks": {
    "totalRows": 3,
    "retainedRows": 2,
    "removedRows": 1,
    "zeroStockRows": 1,
    "invalidQuantities": 1
  },
  "cleanedRows": [
    {
      "SKU": "STOCK-4",
      "Qty": "4",
      "Cost": "3.00"
    },
    {
      "SKU": "STOCK-UNKNOWN",
      "Qty": "",
      "Cost": "3.00"
    }
  ]
}

Observation: With removeZeroStock enabled, only the numeric-zero row is removed. Blank stock is invalid/unknown, not zero, and remains.

Download synthetic fixture

Sources