D
D
Dmitry2021-02-06 09:13:21
JavaScript
Dmitry, 2021-02-06 09:13:21

How to make price rounding in minishop so that there are 4 digits after the decimal point?

I made sure that in the admin panel in minishop2 it was possible to drive in a price up to ten thousandths and save it, but in the basket it still does not appear that way. For example, instead of: 0.4398 rounds up to 0.44.
The only thing left is to change in assets/components/minishop2/js/web/default.js
Perhaps somewhere in this place, but this is not certain:

miniShop2.Utils = {
        empty: function (val) {
            return (typeof(val) == 'undefined' || val == 0 || val === null || val === false || (typeof(val) == 'string' && val.replace(/\s+/g, '') == '') || (typeof(val) == 'object' && val.length == 0));
        },
        formatPrice: function (price) {
            var pf = miniShop2Config.price_format;
            price = this.number_format(price, pf[0], pf[1], pf[2]);

            if (miniShop2Config.price_format_no_zeros && pf[0] > 0) {
                price = price.replace(/(0+)$/, '');
                price = price.replace(/[^0-9]$/, '');
            }

            return price;
        },

Help please)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2021-02-11
@ig0r74

Change system setting ms2_price_format

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question