好吧,事实证明我已经做到了,但实际上没有确切说明每件事的工作原理。
add_filter(\'woocommerce_variable_price_html\', \'custom_variation_price\', 10, 2);
function custom_variation_price( $price, $product ) {
$price = \'\';
if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= \'<span class="from">\' . _x(\'From\', \'min_price\', \'woocommerce\') . \' </span>\';
$price .= woocommerce_price($product->get_price());
if ( $product->max_variation_price && $product->max_variation_price !== $product->min_variation_price ) {
$price .= \'<span class="to"> \' . _x(\'-\', \'max_price\', \'woocommerce\') . \' </span>\';
$price .= woocommerce_price($product->max_variation_price);
}
return $price;
}
我只是换了一行:
if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= \'<span class="from">\' . _x(\'From\', \'min_price\', \'woocommerce\') . \' </span>\';
收件人:
if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price )
有人确切地知道\\u x()函数是如何工作的吗?我确实看到了
their documentation 但它并不是真正的描述性。