Forums › Forums › Search & Filter Pro › Getting WooCommerce result count elsewhere
- This topic has 3 replies, 2 voices, and was last updated 6 years, 2 months ago by
Trevor.
Viewing 4 posts - 1 through 4 (of 4 total)
-
Anonymous(Private) May 20, 2020 at 9:37 am #245049
Hi there,
Using the filter for WooCommerce it shows the amount of products as a result (Showing 132 results).
Is there a way to get this number of results shown and updated elsewhere? Using the hook “woocommerce_result_count” doesn’t update when the filter is updated, probably because it’s not in the search results div?
Best,
DaveAnonymous(Private) May 20, 2020 at 2:46 pm #245141Hi Trevor, thanks for the quick reply. Updated our licence in the meantime.
You pointed me in the right direction, for anyone wondering I’m using the following. Basically waiting for the sf:ajaxfinish, then copying the result count into my own span.
// // Woo Result Count // // Load initial result count var newCount = $('.woocommerce-result-count span.count').text() $(".show-results .new-product-count").text(newCount); // During ajax load get loading dots $(document).on("sf:ajaxstart", ".searchandfilter", function(){ $(".show-results .new-product-count").text('...'); }); // Add result count after loading finishes $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ //console.log("S&F ajax finished"); var newCount = $('.woocommerce-result-count span.count').text() $(".show-results .new-product-count").text(newCount); }); -
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)