Php 在WooCommerce中通过其slug获取产品属性标签名称
我创建的产品属性如下:Php 在WooCommerce中通过其slug获取产品属性标签名称,php,wordpress,woocommerce,attributes,custom-taxonomy,Php,Wordpress,Woocommerce,Attributes,Custom Taxonomy,我创建的产品属性如下:Colorhave slugColor/Sizehas slugSize 在产品中:如何通过slug显示颜色名称/标签 我尝试使用wc\u-get\u-product\u术语,但它的属性值为color/size而不是var\u-dup(color/size)information。使用wc\u-attribute\u-label()时,您可以通过其slug获得产品属性标签名称,如: $attribute_slug = 'color'; $attribute_ta
Color
have slugColor
/Size
has slugSize
在产品中:如何通过slug显示颜色
名称/标签
我尝试使用wc\u-get\u-product\u术语,但它的属性值为
color/size
而不是var\u-dup(color/size)
information。使用wc\u-attribute\u-label()
时,您可以通过其slug获得产品属性标签名称,如:
$attribute_slug = 'color';
$attribute_taxonomy = 'pa_' . $attr_slug;
echo wc_attribute_label( $attribute_taxonomy );
及
使用
wc\u attribute\u label()
可以通过其slug获取产品属性标签名称,如:
$attribute_slug = 'color';
$attribute_taxonomy = 'pa_' . $attr_slug;
echo wc_attribute_label( $attribute_taxonomy );
及