我正在使用 Woo Variations Table 插件,想在属性权重之前添加文本。有办法做到吗?我能够在价格之前添加标签文本,但在重量方面却没有运气。
// code
add_filter( 'woocommerce_get_price_html', 'cw_change_product_price_display' );
add_filter( 'woocommerce_cart_item_price', 'cw_change_product_price_display' );
function cw_change_product_price_display( $price ) {
$text = __('TEXT');
// returning the text before the price
return $text . ' ' . $price;
}
最佳答案
add_filter( 'woocommerce_format_weight', 'woocommerce_format_weight', 10, 2 );
function woocommerce_format_weight( $weight_string, $weight ) {
return __( "Weight Text", "woocommerce" ) . $weight_string;
}
关于php - 在 Weight WooCommerce 之前添加文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65786613/