A PrestaShop 8/9 module that fetches currency exchange rates from the National Bank of Poland (NBP) public API and writes them into PrestaShop's own currency conversion rates — no manual updates, no third-party paid services.
- Why am I still updating exchange rates by hand every day?
- Why do currency-rate modules on the marketplace charge a subscription for something a free central-bank API already provides?
- I only need a couple of currencies tracked (not a full 150-currency dashboard) — why is every existing option so heavy?
This module talks directly to api.nbp.pl, so rates are grounded in the actual published NBP tables (A/B/C) rather than a paraphrased or scraped copy — pick which currencies to track and it keeps PrestaShop's conversion rates in sync (per shop in multistore), on a schedule you control.
- Zip the
nbpcurrency/folder. - PrestaShop back office → Modules → Upload a module → select the zip.
- Open the module's configuration page, add the currencies you want tracked and pick an NBP table (A, B, or C) per currency.
- Each tracked currency is matched against one of NBP's three published tables — A (32 major currencies, daily mid rate), B (116 less-liquid currencies, weekly mid rate), C (13 currencies, daily bid/ask). The module validates your choice against the currency codes NBP actually publishes in each table.
- If your shop's default currency isn't PLN, that default currency must itself be tracked — NBP always quotes against PLN, so it's the anchor used to compute every other tracked currency's cross rate.
- Multistore: choose which shops get updated. Each shop is handled according to its own default currency, and the rate is written to that shop's
ps_currency_shoprow. Module settings are global, so it doesn't matter which shop's domain the cron URL is called on. - Rates are only written when they actually change — a run with no new NBP table (weekend, holiday, table B outside Wednesday) writes nothing, and the module never flushes the Smarty cache.
- Enable auto update to refresh rates via the
actionCronJobhook (PrestaShop's CronJobs module), or callcron/update.php?token=...from an external cron — the token is generated on install and shown on the configuration page. - Every fetch (success or failure) is written to a rate log, visible on the configuration page, for troubleshooting a missed or rejected update.
- Verified against: PrestaShop 9.1.4, PHP 8.x, MariaDB.
- Declared compatibility: PrestaShop 8.0+ (
ps_versions_compliancyinnbpcurrency.php) — not yet manually tested on 8.x, only on 9.1.4. - Outbound HTTPS access to
api.nbp.plis required from the shop's server. - NBP's currency lists (which codes live in which table) are hardcoded as class constants, checked directly against the live API — table membership can change over time; open an issue if NBP adds/removes a currency and the module rejects it incorrectly.
- Fixed: the module no longer calls
Tools::clearSmartyCache()after every rate write. That flushed the whole Smarty cache and all compiled templates on every cron run, so the next storefront requests had to rebuild every module's cached output — a database load spike once a day (or several times, one per tracked currency). - Fixed: conversion rates are no longer saved through
Currency::save(), which overwrote the currency's localized names and symbols in all languages with the value of the current context language. - Fixed (multistore): settings are stored globally and rates are written per shop. Previously the shop context of the request (e.g. the domain the cron URL was called on) decided where settings were saved and which shop's rates were updated.
- Added: shop selection in the back office and per-shop conversion rates in the tracked-currency table.
- Changed: unchanged NBP tables are not logged again on scheduled runs; a manual "fetch now" always logs.
- Initial release.
Corrections and additions welcome — NBP's published tables and PrestaShop's core both keep moving. Open an issue or PR with the PrestaShop version you observed.
MIT.
Marcin Bręczewski (@Breczek) — PrestaShop development.
