我通过查看WooCommerce模板源代码找到了您想要的挂钩(review-order.php
). 代码如下:
add_filter( \'woocommerce_get_price_html\', \'kd_custom_price_message\' );
add_filter( \'woocommerce_cart_item_price\', \'kd_custom_price_message\' );
add_filter( \'woocommerce_cart_item_subtotal\', \'kd_custom_price_message\' ); // added
add_filter( \'woocommerce_cart_subtotal\', \'kd_custom_price_message\' ); // added
add_filter( \'woocommerce_cart_total\', \'kd_custom_price_message\' ); // added
function kd_custom_price_message( $price ) {
$afterPriceSymbol = \'.-\';
return $price . $afterPriceSymbol;
}
值得注意的是,在本例中,WooCommerce>Settings>Currency Options>Number of Decimals设置为0。
Cart
Checkout