In your WP_Query
, only return ids
.
https://developer.wordpress.org/reference/classes/wp_query/#return-fields-parameter
Create an empty array, $myArray = array();
.
Then loop thru the results of the query, $your_query->posts
and fetch your field value for each id and add the result and the id to a new array in $myArray
.
Then sort the arrays in $myArray
by the price.
Then do anothera loop thru $myArray
to output the display you want for each post id.