【发布时间】:2019-06-25 02:46:22
【问题描述】:
我尝试将“选择一个选项”的值更改为属性名称。因此,在您可以选择颜色的下拉列表中,它应该是名称颜色作为第一个。到目前为止,它使用此代码 sn-p
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'cinchws_filter_dropdown_args', 10 );
function cinchws_filter_dropdown_args( $args ) {
$var_tax = get_taxonomy( $args['attribute'] );
$args['show_option_none'] = apply_filters( 'the_title', $var_tax->labels->name );
return $args;
}
我现在遇到的问题是它显示“产品颜色”或“产品材质”,所以它在属性值之前添加了一个产品。如何只获取属性值?
【问题讨论】:
标签: php wordpress woocommerce custom-taxonomy