我已将 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 关注
- 115 浏览
添加回答
举报
0/150
提交
取消