Back to Documentation
Dropshipping Module

How Do Dropshipping Stock Freshness and Safe Reopening Work?

Learn IHASHOP Dropshipping stock freshness, safe reopening, stock snapshots and marketplace notifications.

What is stock freshness?

IHASHOP Dropshipping 1.0.0 checks zero-to-positive stock transitions in real mode through strict reopening. This guide follows reviewed b817b5d9. Freshness here does not mean stock observed within a specified age. Real-time supplier inventory is not guaranteed.

Skipped products and strict reopening

SenkronKosuServisi merges external product IDs skipped because of validation, supplier-wide variant duplication or category conflicts. StokYazici::uygula receives atlananDisUrunler. An external product absent from the list is treated as taze=true. The check is product-level. StokKarari first handles trash and unreadable core. S = max(0, K − T − R); blocked variant, missing source or null stored stock targets zero.

Ledger conflict is checked first. If core stock is zero or negative, S positive and taze=false, ACILIS_ERTELENDI returns null write target. This also applies to first takeover. Positive-to-positive changes do not use the same freshness gate. Deferred opening does not create a new sales block.

Stock change time and snapshots

KaynakKalicilikServisi updates last_stock and last_stock_at only for first non-null stock or changed value. Timestamp is run started_at. Repeated equal stock does not refresh it. last_seen_at is not necessarily refreshed on unchanged rows either. SnapshotKarari requests first known or changed stock. EloquentSnapshotYazici writes quantity, observed_at, sync_run_id and supplier_variant_id, avoiding duplicate run/variant snapshots.

Source and snapshot share product transaction. Archives are skipped. Preview and threshold rejection write no snapshots. observed_at is run start, not supplier measurement time. Example 09:00 stock 10, 10:00 stock 10, 11:00 stock 15, 12:00 stock 15: last_stock_at stays 11:00.

Missing sources and null stock

DbStokOkuyucu treats product or variant missing_since or state missing/archived as source loss. Missing markers may be written after successful source persistence. Skipped products are not marked missing; old records remain. Returning identity can clear missing_since. Incoming null preserves old last_stock. A product absent from skipped list may therefore treat old positive stock as fresh.

This is a source-derived risk, not measured live incident. No general hour/minute expiry or independent last valid stock observation field was found. Missing source targets zero but external conflict can prevent writing. Shadow report does not measure freshness.

Real stock writing and marketplaces

During real Apply, StokYazici evaluates active variant link and core stock in a transaction. CekirdekStokYaziciUygulama updates ProductVariant stock and recalculates parent stock_quantity from variant sum. ProductVariantObserver checks variant links and parent links without variant when price or stock changes. It sets sync_status=pending for Trendyol, n11 and hepsiburada. Pending is not successful marketplace API delivery.

This observer section does not directly call network. Equal stock avoids unnecessary model writing; reference trace may refresh.

Back-in-stock notifications

ProductObserver::saved dispatches NotifyBackInStockJob when total product stock changes from zero or negative to positive. A single variant opening when product total is already positive does not mean the same notification. Job stops if product missing or depleted again. Unnotified subscribers are read in chunks of 200. Successful mail updates notified_at. Sending errors are caught and logged without marking subscriber.

Queue dispatch is not delivery proof. Job does not separately check product activation or DS sales block. Exact-once sending under concurrent jobs was not verified. stats.stok.sayilar.bildirim_olurdu counts variant transitions, not delivered emails.

GiyimDepom and Luxstoree examples

Illustrative GiyimDepom: source 10, buffer 2, reserve 1, core 0, ledger consistent. If negative invalid stock causes product skip, stored 10 yields target 7 but no write: acilis_ertelendi. Next valid run may write 7. Luxstoree: source 20, buffer 3, reserve 4, core 0. Valid non-skipped source may write 13. Incoming null next run may preserve 20; not proof of new observation. Missing marker yields zero target.

Not live inventory; other checks assumed passing.

GiyimDepomLuxstoree10 − 2 − 1 = 720 − 3 − 4 = 13acilis_ertelendi: 0yazardi: 130 → 70 → 13

Tests and operational checks

StokDefteriTest 138–166 expects first 0→10, product aggregate, pending and NotifyBackInStockJob dispatch using Queue::fake; not actual mail or marketplace API delivery. 167–190 tests negative-stock skipped product and later healthy reopening to 10. 503–517 covers decision table, freshness, buffer, reserve and closed gates.

SnapshotYazimTest 48–92 covers first observation, unchanged and changed stock; 145–275 covers preview, thresholds, transaction and archives. KaynakKalicilikTest 189–235 covers loss and return, 313 onward skipped product. Tests were not rerun. Review Preview and protection thresholds. After real Apply inspect stats.stok.sayilar.acilis_ertelendi, yazilan, cakisma, hata and actual inventory.

Verify storefront, queue and marketplace separately.

Related guides

Frequently asked questions

Is last_stock_at latest observation?

No; it is first record or stock change time.

Can a skipped product reopen from zero?

No; acilis_ertelendi defers eligible positive opening.

Does null stock mean zero?

No; previous stored stock may remain.

Does pending mean marketplace delivery succeeded?

No; synchronization remains pending.

Does queued notification prove mail delivery?

No; execution and delivery need separate verification.

How Does Dropshipping Order Management Work?

Frequently asked about this

No; it is first record or stock change time.