woocommerce get list of attribute values

前端 未结 4 899

I\'m using woocommerce on wordpress to create a simple shop site and I\'ve added a couple attributes to a product. These are namely, size and color. Un

4条回答
  •  名媛妹妹
    2021-02-04 09:04

    This post was written some time ago so I don't know if Woocommerce had this method in its previous incarnations.
    For anyone else looking to do this, this line is all you need.

    $product->list_attributes();
    

    This allows you to customize the order and toggle whether or not you want to display the variation in the backend,

提交回复
热议问题