I try sorting products (no Woocommerce, but created by custom post_type) in my site by price. I have two Advanced Custom Fields = price
and price_sale
.
I need result like this:
- 1999$
- 2222$ (price_sale) 4000$
- 3200$ (price_sale) 3600$
- 3500$
I have this query arguments:
{
"categories": "sofas",
"meta_query": {
"relation": "AND",
"1":{
"relation": "AND",
"query_one": {
"key": "price",
"type": "NUMERIC"
},
"query_two": {
"key": "price_sale",
"type": "NUMERIC"
}
}
},
"orderby": {
"query_two": "ASC",
"query_one": "ASC"
}
}
And result - all promotional products go after the usual while being sorted by price, like this:
- 1999$
- 3500$
- 2222$ (price_sale) 4000$
- 3200$ (price_sale) 3600$
I need them to sort through the two fields and displaying like as first example above.