WooCommerce Price Filter – Trigger When Slider Changes

0
712

So that when filtering prices in the WooCommerce CMS online store of the WordPress standard filter system, automatic filtering occurs without clicking a button, you can insert this js code into the file with js scripts of your theme:

jQuery( document ).ready(function($) {
    var priceSliderElements = $('.price_slider');
    var priceFilterFormSubmit = $('.widget.woocommerce.widget_price_filter .button[type="submit"]');
    priceSliderElements.on('click', function() {
        priceFilterFormSubmit.click();
    })
});

As a result, when you change the price filter in WooCommerce, products will be automatically filtered.

LEAVE A REPLY

Please enter your comment!
Please enter your name here


Notice: Function amp_has_paired_endpoint was called incorrectly. Function called while AMP is disabled via `amp_is_enabled` filter. The service ID "paired_routing" is not recognized and cannot be retrieved. Please see Debugging in WordPress for more information. (This message was added in version 2.1.1.) in /www/wwwroot/offgalaxy.com/wp-includes/functions.php on line 6085

Notice: Function amp_has_paired_endpoint was called incorrectly. Function called while AMP is disabled via `amp_is_enabled` filter. The service ID "paired_routing" is not recognized and cannot be retrieved. Please see Debugging in WordPress for more information. (This message was added in version 2.1.1.) in /www/wwwroot/offgalaxy.com/wp-includes/functions.php on line 6085