Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ivorpad/mercadona-cli/llms.txt
Use this file to discover all available pages before exploring further.
cart set-many is the preferred way to build or replace a basket. It reads the current cart once, applies every <id> <qty> change you specify, prices the full resulting basket, enforces the budget cap if set, and issues a single PUT — no race conditions between concurrent reads, and no repeated round-trips to the server.
Synopsis
Flags
| Flag | Default | Description |
|---|---|---|
-f <file> | — | File with one <id> <qty> per line (- = stdin) |
--max <eur> | 0/env/config | Refuse if resulting cart total exceeds this amount |
--wh <code> | config/mad1 | Warehouse code |
--lang <code> | config/es | Language code (es, en, ca, eu, vai) |
--json | false | Emit raw cart JSON (PUT response) |
Input format
Supply changes as one<id> <qty> pair per line. A qty of 0 removes that product line. Inline # comments are supported, making the file self-documenting.
basket.txt
Examples
How the budget guard works
When--max is set (or MERCADONA_MAX_EUR/[limits].max_eur is configured), set-many runs a two-stage spending check:
- Pre-write estimate — prices the full resulting basket before the PUT. Prices already present in the cart GET response are reused; only new product IDs are fetched. If the estimate exceeds the cap, the command refuses without writing — your cart is untouched.
- Authoritative post-write check — after the PUT, the real total returned by the API is compared against the cap. If it still breaches the limit (due to promotions or rounding the estimate missed), the cart is reverted to its pre-change state.
BUDGET EXCEEDED error message.
Human output format
After a successful write, a summary line lists the number of changes alongside the new cart totals, with each changed line indented below:qty = 0 is shown as → (eliminado). If the basket is below the 60€ delivery minimum, a shortfall hint is printed after the change list.
The same basket file works for both
mercadona total -f basket.txt (a no-auth pre-cart price estimate) and mercadona cart set-many -f basket.txt (the actual write). Use total to size and verify the basket before committing it to the cart.