Order by summing multiple values

I wouldn’t use taxonomies or custom fields for this purpose. Every time you’re add one custom field for a query, you have to add a JOIN part for that query – it means that with 10-15 custom fields, you’ll get query with 10-15 joins – so such query will be very slow.

But there is some nice trick you can use in such case. I would approach it this way:

  1. Create custom DB table with a column for every property that can be included in sum. (So there should be one external key post_id which will allow you to join this table with posts table and then one column for every property – so basic_cost, extra_cost, extra_cost_2 and so on – or whatever your properties are…) This way you’ll be able to use these columns in a sum and the query will need only one join.
  2. Use save_post hook to fill that table with meta values.
  3. Use posts_clauses hook to join your custom table and order by whatever sum you want based on fields in that table.