Finding the best results using a range of values
I'm currently working on a health and fitness website where a user inputs their daily calories and macro nutrients information (carbs, fat and protein).
I have thousands of food items with custom meta for calories, carbs, fat and protein.
I've developed a search that can find food items between set values using a meta query but now I would like to try and take it to the next level.
For example, if a user wants to have 200g of carbs, 75g of fat and 120g of protein then it would show the foods that would all best add up to those values. So not just find the one food item but a list that would roughly add up to the 200g, 75g and 120g values set by the user.
Just looking for some guidance on the best way to go about this, please.
Topic meta-query comparison loop custom-field Wordpress
Category Web