[plugin-ecommerce] Inventory defaults to 0, so products that don't track stock (digital goods) can't be bought; no per-product "unlimited" option
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- postgresql, typescript
Direzione di ricerca
Start by tracing inventoryField and defaultProductsValidation, then follow confirmOrder to decrementInventory; the issue also points to #18288 for related inventory configuration behavior. Compare how null inventory is handled with the default value and decrement path, including variants. Done means untracked or unlimited products can be purchased without breaking stock tracking for physical products.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the Bug
In a shop that sells both physical and digital products, stock only makes sense for the physical ones. The plugin has no per-product way to say "this product doesn't track stock", and the defaults make digital products fail in two places:
- New products start sold out.
inventoryFieldsetsdefaultValue: 0, anddefaultProductsValidationtreatsinventory === 0as out of stock. Every new product created in the admin is therefore refused atinitiateuntil someone enters a number or clears the field. Clearing it works becausenullis treated as unlimited, but nothing in the admin tells editors that. - Stock is decremented for every line.
confirmOrder→decrementInventoryruns$inc: -quantityfor every transaction item, digital ones included. If an editor enters a number such as 100 to get past point 1, the product sells down to 0 and then starts refusing purchases again. With a non-negative check on the column, settlement fails after the customer has already paid.
Turning stock off globally (inventory: false) isn't a workaround for mixed shops: physical products lose stock tracking. Per #18288 the decrement also doesn't read the inventory config, so false may not stop it anyway.
Expected
One of these, or something similar:
- a per-product (and per-variant) "Track inventory" toggle, with untracked products skipped by both the validation and the decrement, or
null(unlimited) as the default, documented as "leave empty for unlimited", with the admin able to show the field conditionally.
Workaround we use
A beforeChange field hook on inventory stores null for non-physical product types; null + -1 stays null in Postgres. We also hide the field for those types with an admin.condition.
Related
#18288 (inventory config not passed to the decrement / fieldName unused)
Environment
@payloadcms/plugin-ecommerce4.0.0-beta.8- Postgres adapter
- Lingua principale
- TypeScript
- Stelle
- 45.8k
- Fork
- 4.4k
- Merge medio
- 3g 4h
- PR unite (30g)
- 210
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di payloadcms/payload
-
area: ui Bug Payload OSS
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
payloadcms/payload#19839 ·
I maintainer di solito rispondono entro 1 giorno
-
Accessibility: list row and select-all checkboxes still unnamed in 3.x (#17376 fix not in 3.91)ApertaBug Payload OSS
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
payloadcms/payload#19837 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Payload OSS
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
payloadcms/payload#19835 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Payload OSS
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
payloadcms/payload#19833 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Payload OSS
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
payloadcms/payload#19832 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di payloadcms/payload
Issue simili
-
[BUG]: Shared links drop the configured basePath on GitHub PagesForse già presa @anshulchikhale30-p l’ha presa oggi. Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
StabilityNexus/IdentityTokens-EVM-Frontend#182 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add: GTrekkerApertacheck:passed streams:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Koenkk/zigbee-herdsman-converters#13900 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
jeanibarz/knowledge-base-mcp-server#1291 ·
I maintainer di solito rispondono entro 1 giorno