Woocommerce动态定价插件:在定价前添加自定义文本

Woocommerce动态定价插件:在定价前添加自定义文本,woocommerce,Woocommerce,我正在使用woocommerce动态定价插件-如何更改“发件人”字段并替换为自定义文本 这是我的代码,它试图过滤 测试文本工作正常,但价格返回为0.00 add_filter( 'wc_dynamic_pricing_price_html', 'custom_single_price'); function custom_single_price ($html, $_product) { $from = '<span class="test">' . _x( 'TEST

我正在使用woocommerce动态定价插件-如何更改“发件人”字段并替换为自定义文本

这是我的代码,它试图过滤

测试文本工作正常,但价格返回为0.00

add_filter( 'wc_dynamic_pricing_price_html', 'custom_single_price');

function custom_single_price ($html, $_product)  {

    $from = '<span class="test">' . _x( 'TEST:', 'min_price', 'woocommerce' ) . ' </span>';
    $html = '<del>' . WC_Dynamic_Pricing_Compatibility::wc_price( $base_price ) . '</del><ins> ' . $from . WC_Dynamic_Pricing_Compatibility::wc_price( $display_price ) . '</ins>';

return $html;
}
add_filter('wc_dynamic_pricing_price_html','custom_single_price');
函数自定义\u单一\u价格($html,$\u产品){
$from='.'x('TEST:'、'minu price'、'woocommerce');
$html=''.WC_动态_定价_兼容性::WC_价格($base_price)。''.$from.WC_动态_定价_兼容性::WC_价格($display_price)。';
返回$html;
}