在一个查询中按分类标准订单发布

时间:2019-01-17 14:00:24

标签: wordpress woocommerce hook-woocommerce

我必须使用“ WooCommerce”列出按“ term_order”(添加到“产品分类”中的字段)订购的产品。

例如:

- Product [A] - from Term (1)
- Product [B] - from Term (1)
- Product [C] - from Term (1)

- Product [A] - from Term (2)
-------- PAGE 2 -------
- Product [B] - from Term (2)
- Product [C] - from Term (2)

- Product [B] - from Term (3)
- Product [C] - from Term (3)
-------- PAGE 3 -------
- Product [E] - from Term (3)
- Product [F] - from Term (3)

顺便说一句,我不能使用术语遍历和每个术语遍历产品,因为我必须使用分页并且WooCommerce插件将使用此查询。

然后,我需要查询“产品”,该订单适用于分类法“ product_cat”(在产品标题之后)。

我已经测试了很多查询,例如:

[
    'orderby' => ['meta_value_num' => 'ASC', 'title' => 'ASC'],
    'meta_key' => 'term_order',
    'tax_query' => [[
        'taxonomy' => 'product_cat',
        'field' => 'term_order'
    ]]
]

没有成功。

感谢您的帮助。

0 个答案:

没有答案