BUG: Can't set "order meta key" in query loop

On a Woocommerce site, I have a custom attribute named “Style”. I want to order the records output in a query loop by this field, so I set “Order by” to “Meta value” and entered the name of the field (“pa_style” as the “order meta key”. No records are output when I do this. What am I doing wrong?


@timmse This is another bug that I’d like to have a fix or at least a workaround for.

AFAIK pa_style is a taxonomy, not a meta field. Maybe that’s the reason for not working…

Ummm…not sure about that. At least I believe all the other custom attributes are meta fields.

If ap_style WAS a taxonomy, how does one sort by this field?

I’m not an expert (not even close) but I think taxonomies are for grouping data, not for sorting. In a similar situation, I’ll create a custom meta field just for sorting purposes.

1 Like

Hi, did replied your question in Facebook 2 days ago.

Anyway, as tole011 explained, the product attribute is taxonomy. So you are not able to target it from meta. As per my understanding, the orderby in WP_Query not support taxonomy unless a custom SQL query.

TBH, I can’t imagine how should the posts order like if some of them have multiple taxonomy values.

If your RP6860 is some kind of SKU and 1 product only has 1 “Style”, maybe you should try set it at Inventory → SKU and order by SKU?

OK. Thanks for the reply. BTW are you another forum member like me or are you part of the Bricks developer team? I.e. is this an official Bricks team response?

I am just a normal member like you :smiley:
This is just my personal response.

1 Like