为了账号安全,请及时绑定邮箱和手机立即绑定

在 WooCommerce 中通过其别名获取产品属性标签名称

在 WooCommerce 中通过其别名获取产品属性标签名称

PHP
温温酱 2023-10-21 10:07:04
我已将 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 );


查看完整回答
反对 回复 2023-10-21
  • 1 回答
  • 0 关注
  • 115 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号