【问题标题】:Get list of attributes of a specific woocommerce product获取特定 woocommerce 产品的属性列表
【发布时间】:2015-07-02 09:37:56
【问题描述】:

我有一个产品 ID 数组,我想在数组中获取每个产品的属性。

这是否可以从产品 ID 中获取属性列表?

【问题讨论】:

    标签: plugins woocommerce


    【解决方案1】:

    我找到了解决方案。

    使用 get_post_meta() 获取属性并使用 get_terms() 获取术语值列表,例如:

    $attribute = get_post_meta( $products->post->ID, '_product_attributes', true);
    
    get_terms($attribute);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-02
      • 2016-11-24
      • 1970-01-01
      • 2018-11-28
      • 2018-10-11
      • 1970-01-01
      • 1970-01-01
      • 2019-01-25
      相关资源
      最近更新 更多