简体   繁体   中英

Woocommerce default sorting is not working

I am using Woocommerce plugin with wordpress and getting issue in sorting. When i was try to sort with select option, page not reloading. I think this is some JavaScript issue, please help me to rectify his issue.

This is the HTML code:

<form class="woocommerce-ordering" method="get">
    <select name="orderby" class="orderby">
                    <option value="popularity">Sort by popularity</option>
                    <option value="rating">Sort by average rating</option>
                    <option value="date">Sort by latest</option>
                    <option value="price" selected="selected">Sort by price: low to high</option>
                    <option value="price-desc">Sort by price: high to low</option>
            </select>
    <input type="hidden" name="paged" value="1">
    </form>

You can simply put this javascript function to your footer.

$(function() {
    $('.woocommerce-ordering select').change(function() {
        this.form.submit();
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM