我已將 Product_attributes 創建為:Colorhave slug color/ Sizehas slugsize在產品中:如何color通過 slug 顯示名稱/標簽。我嘗試 wc_get_product_terms 但它是屬性值而color / size不是var_dup(color / size)信息。
1 回答

蝴蝶不菲
TA貢獻1810條經驗 獲得超4個贊
您可以通過其 slug 獲取 Product_attributes 標簽名稱,wc_attribute_label()例如:
$attr_slug = 'color';
$attr_taxonomy = 'pa_' . $attr_slug;
echo wc_attribute_label( $attr_taxonomy );
和
$attr_slug = 'size';
$attr_taxonomy = 'pa_' . $attr_slug;
echo wc_attribute_label( $attr_taxonomy );
- 1 回答
- 0 關注
- 137 瀏覽
添加回答
舉報
0/150
提交
取消