【问题标题】:Issue filtering woocommerce products in PHP在 PHP 中过滤 woocommerce 产品问题
【发布时间】:2019-12-24 06:48:07
【问题描述】:

早上好!这应该很简单,我正在尝试按“区域”过滤产品,但我的参数似乎对此查询生成的 woocommerce 产品列表没有任何影响?非常感谢您的帮助。

$args = array(
    'type' => 'product',
    'meta_query' => array(
        '_stock_status' => 'instock',
        'Region' => 'Mexico'
    )
);
foreach ( wc_get_products( array( $args, 'limit' => -1 ) ) as $product ) {

    foreach ( $product->get_attributes() as $attr_name => $attr ) {}}

【问题讨论】:

    标签: php wordpress woocommerce


    【解决方案1】:

    可能你需要把 R 改成 r

     'Region' => 'Mexico' change to   'region' => 'Mexico'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-18
      • 2019-02-12
      • 1970-01-01
      • 2016-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多