Skip to main content

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

mercadona set-postal <postal_code> [flags]

Arguments

ArgumentDescription
<postal_code>5-digit Spanish postal code (e.g. 28022)

Flags

FlagDefaultDescription
--wh <code>config [defaults].warehouse, else mad1Warehouse code override (unused by resolution itself; sets context for subsequent commands)
--lang <code>config [defaults].lang, else esLanguage for API responses
--jsonfalseEmit {"postal_code": "<cp>", "warehouse": "<wh>"} JSON

Examples

# Resolve a postal code and save the warehouse as your default
mercadona set-postal 28022
# ok — postal code 28022 → warehouse mad1 (saved to ~/.mercadona/config.toml)

# A different postcode in the same city may map to a different warehouse
mercadona set-postal 28013
# ok — postal code 28013 → warehouse mad3

# Machine-readable output
mercadona set-postal 28022 --json
# {"postal_code": "28022", "warehouse": "mad1"}

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.
If you’ve already run import-har, the warehouse is auto-detected from your browser session and saved to config.toml automatically — no need to run set-postal separately. import-har also captures the language preference from the session. You can always override the saved warehouse on any individual command with --wh <code>.

Build docs developers (and LLMs) love