Limit the number of decimals shown on the price slider

  • pseudo visitor
    Participant
    # 11 months, 3 weeks ago

    I’ve setup a price slider for my WooCommerce site.

    I’d like to limit the number of decimals shown on the slider.

    wpsolr
    Keymaster
    # 11 months, 3 weeks ago

    Our slider is built on the ion.rangeSlider: https://ionden.com/a/plugins/ion.rangeSlider/demo.html

    You can use all the ion.rangeSlider javascript options in the facet javascript text area:

    Facets slider javascript settings

    For instance, to display 3 decimals:

    wpsolr_ion_range_slider_options = { 
       type: "double",
       grid: false,
       prefix: "€",
       prettify_enabled: true,
       prettify: function (num) {
            return Number.parseFloat(num).toFixed(3);
       }
    };
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.