It looks like the inbuilt price filter has the ability to adapt to the price of the products being shown, but I'm not sure if you're able to maintain the adaptability with a custom range. So we have come up with 2 sets of ranges, depending on whether or not you can make it adapt.
This range here is our preference, if it is able to adapt based on what is returned in the product search results ...
The thing is that the price range is configured as the product attribute as you can see here:
=> hidden link
Toolset just add that Price attribute as filter to it and it will just display the price range what is configured with attribute. It will display the price range to for which the records are available currently:
=> hidden link
- As you can see with the above link, there is one record available and it displays the associated price range.
If you want to display all price range, then you will require to change the "Custom Search Settings" to "Always show all values for inputs" as shown with the following screenshot:
=> hidden link
Ahhh ... bugger. I didn't realise it was based off of existing attributes.
Is it possible to change to using the actual price and not an attribute? You asked earlier which field we want to use, I'm not sure how to refer to it, but as I understand there is a field that uses the sale price, but if no sale price exists then use the actual price?
I've added the Product Price filter (you can remove the price filter which you added), using the custom ranges shared by you as given under to "Search and Pagination" section:
As we are using the taxonomy archive where we setup the custom search, we need to use the WP hook "pre_get_posts" in order to filter the query results based on the custom price range we added for Product Price field.
I've added the following code to "Custom Code" section of Toolset:
=> hidden link
I've removed the other price filter I had in there, and moved the spinner to below the price filter you put in.
However, it doesn't seem to be working properly. On the page link you sent, it might appear to be working as there are 2 products that don't have a price, which no matter which price range you click on it shows those two products. If you have a look at this page: hidden link you can see that no matter which price range you click on it doesn't return any results.
Also, the $10,000+ filter doesn't show, and is it possible for price ranges that don't have any products to be hidden?
Sorry for the delay, I had a deadline for another project yesterday so didn't get back to this one til this morning.
That's working much better now, thanks for making those adjustments. How do we now get it to give a count of number of products in each price range, the way that it does for the Brand filter? Also, is it possible to have it only shows the price ranges that have products in them?
Hi Minesh, I'm confused but am thinking maybe you made a typo. Do you mean "no native way to add ..." ?
If that is the case, can you please advise, or provide a link, information on Toolsets ability to filter WooCommerce products on price? Is there another option? My client will not accept the way that it is working now. The price filter needs to show a count for each one.
If you want to display the count, then you need to compromise with the custom prize range and you need to use the available price values as filter. Thats is the only option available.