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 set-postal resolves a 5-digit Spanish postal code to the Mercadona warehouse that handles home delivery to that address. It saves both the postal code and warehouse code to ~/.mercadona/config.toml, making every subsequent command use the correct regional catalog and prices. No authentication is required — this command works before login.
Synopsis
Arguments
| Argument | Description |
|---|---|
<postal_code> | 5-digit Spanish postal code (e.g. 28022) |
Flags
| Flag | Default | Description |
|---|---|---|
--wh <code> | config [defaults].warehouse, else mad1 | Warehouse code override (unused by resolution itself; sets context for subsequent commands) |
--lang <code> | config [defaults].lang, else es | Language for API responses |
--json | false | Emit {"postal_code": "<cp>", "warehouse": "<wh>"} JSON |
Examples
What It Does Internally
set-postal calls POST /api/postal-codes/actions/change-pc/ — no authentication needed. It reads the x-customer-wh response header to get the warehouse code, validates that the response is non-empty (an undeliverable postal code errors and leaves config untouched), then writes both postal_code and warehouse to the [defaults] section of ~/.mercadona/config.toml. From that point on, every search, cart, and checkout command defaults to that warehouse.
Run
set-postal before first use. Without it, all commands fall back to mad1 (Madrid). Product IDs and prices are per-warehouse — an ID from the wrong warehouse may return a 404 or a different price. The warehouse must also match the delivery address you select at checkout, or the API will reject the order.