kalicr/format-price (1.0.0)
Installation
{
"repositories": [{
"type": "composer",
"url": " "
}
]
}composer require kalicr/format-price:1.0.0About this package
Module Kalicr_FormatPrice
Configurable Magento 2 module that forces a configurable decimal precision for a target currency (CRC / colón costarricense by default) across catalog, checkout, and storefront price rendering.
This module is developed by Kal-i CR Development Team.
Features
- PHP price formatting: intercepts
Magento\Directory\Model\Currency::formatPrecisionand applies the configured precision for the target currency. - JavaScript locale config: injects
precision,requiredPrecision,groupSymbol,decimalSymbol, andgroupLengthinto the storefront price format. - RequireJS mixin: extends
Magento_Catalog/js/price-utilsfor consistent client-side formatting. - Admin configuration: enable/disable the module and set the target currency code and precision from the Magento admin panel.
Installation
Via Composer
KaliCR packages are published in the Forgejo registry
(https://git.kalicr.com/api/packages/kalicr/composer).
composer require kalicr/format-price:1.0.0
bin/magento module:enable Kalicr_FormatPrice
bin/magento setup:upgrade
bin/magento cache:clean
Manual installation
Only for local debugging. Do not use in client projects while the same module
is also installed via Composer, because having both app/code/ and vendor/
copies causes a duplicate-module error.
- Copy the module into
app/code/Kalicr/FormatPrice. - Run:
bin/magento module:enable Kalicr_FormatPrice
bin/magento setup:upgrade
bin/magento cache:clean
Configuration
- Open the Magento admin panel.
- Go to Stores → Configuration → Kal-í CR → Format Price.
- Set:
- Enable Module: yes/no.
- Currency Code: ISO 4217 code of the currency to format (default
CRC). - Decimal Precision: number of decimals to force (default
0).
- Save the configuration.
The module only affects the configured currency. Other currencies keep their native Magento formatting.
Dependencies
- Magento Open Source / Adobe Commerce:
2.4.8-p4 - PHP:
^8.2 || ^8.3 - Magento modules:
Kalicr_Core,Magento_Catalog,Magento_Directory - Composer packages:
kalicr/core
Compatibility
- Adobe Commerce / Magento Open Source:
2.4.8-p4 - PHP:
^8.2 || ^8.3
Functional usage
When the module is enabled and the current store currency matches the configured currency code, all price rendering (product list, product page, cart, checkout) displays the amount with the configured precision. For the default CRC configuration this means whole-colón prices without decimals and Costa Rican separator conventions.
If the module is disabled, or if the store uses a different currency, the original Magento formatting is preserved unchanged.
Technical notes
- Configuration path:
kalicr_format_price/general/* - Plugins:
Kalicr\FormatPrice\Plugin\PriceCurrency(beforeMagento\Directory\Model\Currency::formatPrecision)Kalicr\FormatPrice\Plugin\PriceCurrencyJs(afterMagento\Framework\Locale\Format::getPriceFormat)
- RequireJS mixin:
view/frontend/web/js/price-utils-mixin.js
Changelog
Release notes are maintained in CHANGELOG.md.
Support
If you need help with this module, contact Kal-i CR Development Team:
- Email:
contacto@kalicr.com
License
This package is distributed under the proprietary KaliCR commercial license. See LICENSE.md.
Release workflow
This repository publishes the package through the Forgejo Composer registry.
- Workflow file:
.forgejo/workflows/package.yml
Required Forgejo secrets for publication:
FORGEJO_PACKAGE_USERNAMEFORGEJO_PACKAGE_TOKEN
Dependencies
Dependencies
| ID | Version |
|---|---|
| kalicr/core | ^0.2.0 |
| magento/framework | ^103.0 |
| magento/module-catalog | ^104.0 |
| magento/module-directory | ^100.0 |
| php | ^8.2 || ^8.3 |