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.
mercadona total fetches live prices for a list of product IDs and quantities, then sums them in integer cents — giving an exact, reproducible figure before you touch the cart. Arithmetic is done in code rather than left to the caller, so the result is deterministic and free of floating-point drift across many lines. It requires no authentication.
Synopsis
mercadona total [-f file] [flags] [id...]
Flags
| Flag | Default | Description |
|---|
-f <file> | — | File with <id> [qty] lines (- = stdin) |
--wh <code> | config/mad1 | Warehouse code (prices are per-warehouse) |
--lang <code> | config/es | Language |
--json | false | Emit JSON {lines, total, count, complete} |
One <id> [qty] per line. Quantity defaults to 1 when omitted. Both whole-line and inline # comments are supported, so lines can be annotated with product names:
# paella base — 3 personas
5044 1 # Arroz redondo Hacendado
60393 1 # Gambón grande congelado
85499 1 # Mejillón mediterráneo
16044 1 # Tomate triturado Hacendado
4740 0.5 # Aceite de oliva virgen extra (fractional qty works)
Examples
# From a file
mercadona total -f paella.txt
# From stdin
printf '5044 1\n13406 1\n' | mercadona total -f -
# Bare IDs as args (qty 1 each)
mercadona total 5044 13406 10379
# Machine output
mercadona total -f paella.txt --json
[5044] Arroz redondo Hacendado — 1 × 1.20€ = 1.20€
[60393] Gambón grande congelado — 1 × 6.00€ = 6.00€
[85499] Mejillón mediterráneo — 1 × 5.80€ = 5.80€
[16044] Tomate triturado Hacendado — 1 × 0.55€ = 0.55€
[4740] Aceite de oliva virgen extra Hacendado — 0.5 × 4.95€ = 2.48€
total: 16.03€ (5 líneas)
Any line whose product ID cannot be priced (e.g. the ID does not exist in the configured warehouse) is reported with ERROR: and excluded from the total. The command exits non-zero when any line fails.
JSON output shape
{
"lines": [
{"id": "5044", "name": "Arroz redondo Hacendado", "qty": 1, "unit_price": "1.20", "subtotal": "1.20"},
{"id": "60393", "name": "Gambón grande congelado", "qty": 1, "unit_price": "6.00", "subtotal": "6.00"},
{"id": "85499", "name": "Mejillón mediterráneo", "qty": 1, "unit_price": "5.80", "subtotal": "5.80"},
{"id": "16044", "name": "Tomate triturado Hacendado", "qty": 1, "unit_price": "0.55", "subtotal": "0.55"},
{"id": "4740", "name": "Aceite de oliva virgen extra Hacendado", "qty": 0.5, "unit_price": "4.95", "subtotal": "2.48"}
],
"total": "16.03",
"count": 5,
"complete": true
}
complete is true when every line was priced successfully. It is false when one or more lines errored, and those lines carry an "error" field instead of unit_price and subtotal.
total is a pre-cart estimate. The authoritative total comes from the cart and checkout API. Use the same basket file directly with cart set-many for the actual write — the input format is identical (<id> [qty] per line with # comments).
Quantities may be fractional for weight or bulk items. For example, 4740 0.5 prices half a unit of olive oil. The subtotal is computed as round(unit_price_cents × qty), so fractional results are rounded to the nearest cent.