Custom currency configuration

Ordinary currency settings are available in section “Settings → Currencies”.

However, there are some special currency settings, which you can edit only via configuration files. Configuration files must contain valid PHP arrays with certain values shown below in this article.

To create or edit a configuration file in Webasyst Cloud, send a request to the support team.

Change currency symbol

Create or edit file wa-config/currency.php. Its contents will affect the use of currencies mentioned in the file in all apps including Shop-Script and CRM.

Example for U.S. dollar (USD):

<?php
return array(
    'USD' => array(
        'sign' => 'US$', //instead of default '$'
        'sign_HTML' => 'US$', //use this option to change currency sign only in the storefront
    ),
);

Value 'sign_html' is used only in the storefront. Value 'sign' is used both in the storefront and in the backend.

Increase decimal precision

Create or edit file wa-config/currency.php. Its contents will affect the use of currencies mentioned in the file in all apps including Shop-Script and CRM.

Example for U.S. dollar (USD). Currency precision used for the calculation of taxes, discounts, services, and total order amount is being changed from default 2 to 4 decimal digits.

<?php
return array(
    'USD' => array(
        'precision' => 4,    //instead of default 2-digit precision
    ),
);

Add custom rounding options

Or to add the option of disabling the rounding.

Create or edit file wa-config/apps/shop/config.php. Its contents will affect the use of all available currencies only within Shop-Script.

<?php
return array(
    'rounding_options' => array(
        '100' => /*_w*/("Round to nearest 100"),
        '99' => /*_w*/("Round to nearest 99"),
        '10' => /*_w*/("Round to nearest 10"),
        '1' => /*_w*/("Round to nearest 1.00"),
        '0.99' => /*_w*/("Round to nearest .99"),
        '0.1' => /*_w*/("Round to nearest 0.1"),
        '0.01' => /*_w*/("Round to nearest 0.01"),
        '0.001'=>'Round to nearest 0.001',    //new rounding option
        '0.0001'=>'Round to nearest 0.0001',    //new rounding option
        '' => 'Not round',    //this is the only method to add the option of disabling rounding
    ),
);

To make option “Not round” available for certain currencies, specify maximum acceptable rounding precision (4) for those currencies in file wa-config/currency.php:

<?php
return array(
    'EUR' => array(
        'precision' => 4,
    ),
    'USD' => array(
        'precision' => 4,
    ),
);

Upon uploading the file to the server, select new rounding options in “Settings → Currencies” section.

As a matter of fact, option “Not round” does not cancel rounding but minimizes it so that it is not visible, unless your website’s design theme shows prices with more than 3 digits after the decimal separator. Usually a maximum of 2 decimal digits are displayed in prices.

0 comments

    Add comment

    To add a comment please sign up or login