Back to Documentation
Dropshipping Module

How Does Dropshipping Stock Management Work?

Learn IHASHOP Dropshipping stock management, safety buffer, reservations, ledger and real inventory writing.

What is stock management?

IHASHOP Dropshipping 1.0.0 does not copy supplier stock directly into shop inventory. Source records, active variant links, sales blocks, safety buffer and order reservations are evaluated together. This guide follows reviewed b817b5d9 source.

Source stock and snapshots

KaynakKalicilikServisi writes new and changed non-null stock to last_stock. last_stock_at is run start time and is not refreshed for unchanged stock. Incoming null preserves old stock. SnapshotKarari requests first known observation or change. EloquentSnapshotYazici inserts quantity, observed_at, sync_run_id and supplier_variant_id into ds_stock_snapshots. Duplicate run/variant snapshots are prevented. Archived records are skipped.

Source and snapshot share a product transaction. Preview and threshold rejection write no snapshots. History is not actual shop stock writing.

Safe stock calculation

StokKarari calculates S = max(0, K − T − R). K is stored source stock, T buffer, R reservation. A blocked variant link, missing or archived source product/variant, or null last_stock produces zero target. DbStokOkuyucu reads only state=active variant links. missing_since or missing/archived means source loss. Product link sale_state is not directly checked by this query. Unlinked source variants receive no real stock write.

Buffer comes from golge_tampon: integer 0–100000; invalid or missing defaults to 0. Zero target does not guarantee a write.

Reservations and stock ledger

Ledger D = sum(deducted_qty − restored_qty). Expected core stock = core_stock_written − (D − ledger_net_at_write). Reserve includes positive net pending allocations and forwarded allocations sent at or after run start or lacking supplier_verified_at. Time passing or a supplier stock drop alone does not release forwarded reserve. Administrator reconciliation is required; open financial reconciliation can prevent it.

Real mode start defines cutoff. Sales before cutoff are not deducted again; qualifying later returns and cancellations may enter ledger. Reserve reduces target; ledger checks core stock conflicts.

Shadow and real mode

Default is shadow mode. Shadow reports without real stock writing. StokYazimServisi::moduDegistir records stok_yazim=gercek and stok_yazim_baslangic per supplier; already-real activation preserves date. Returning to shadow clears settings and write traces, not allocations. Switching alone changes no shop stock. Real writes occur during successful Apply. Shadow and real modes are mutually exclusive.

Review Stock management in supplier administration and check stock and open orders before enabling real mode.

Write safety and freshness

StokYazici uses a short transaction per link. Core variant is locked first, active link next; orders are rescanned. Trash or unreadable core is skipped. Without trace, ilk_devralma writes target; otherwise actual stock must match expected. Conflict retains external value and blocks open variant with stock_conflict. Existing reason remains. Equal target avoids unnecessary model write; trace may refresh.

Zero-to-positive requires fresh source. Current freshness uses skipped external product IDs, not a general stock age limit. Incoming null preserves old stock and may still be treated as fresh: source-derived risk, not measured live incident. Model writes can trigger observers. Individual errors are counted and others may continue. Closed Seller gate stops remaining writes.

GiyimDepom and Luxstoree examples

Illustrative GiyimDepom JSON StockQuantity 100, buffer 5, reserve 12 gives target 83. Last write 90, ledger then 3 and now 10 gives expected core 83. Actual 83 is not a conflict. Luxstoree XML variant/quantity 20, buffer 3, reserve 4 gives target 13. Actual zero and skipped source defer opening. A blocked variant gives target zero, but external stock conflict prevents writing. These are not live supplier stocks.

GiyimDepomLuxstoreeStockQuantityvariant/quantity100 − 5 − 12 = 8320 − 3 − 4 = 1390 − (10 − 3) = 83acilis_ertelendi

Checks and tests

StokDefteriTest covers no shadow writes, first real model write and observers, unchanged stock, strict opening with skipped product, reserve and returns, external conflict and manual reconciliation. Decision table expects 10 − 2 − 1 = 7 and zero target for closed gates. SnapshotYazimTest covers first observation, changes, deduplication and rollback. Existing tests were not rerun. Review stats.stok, errors, kismi, reserve and conflicts.

Verify actual inventory, product activation and storefront purchasability separately.

Related guides

Frequently asked questions

Is supplier stock copied directly?

No; buffer, reserve and safety gates are evaluated.

Does shadow write stock?

No; reports only.

Is null stock zero?

No; incoming null can preserve previous stock.

Does reserve expire automatically?

Forwarded allocations require administrator reconciliation; time or stock drop alone is insufficient.

Does conflict erase external stock?

No; write stops and open link is blocked.

How to Use Shadow Stock and Real Stock Modes

Frequently asked about this

No; buffer, reserve and safety gates are evaluated.