3

我需要在我的购物车页面和结帐页面中显示的价格(小计、总计...)之后添加文字提及。

我知道如何在单页和商店页面上做到这一点,但在其他页面上却不知道。我唯一找到的是这段代码,但它不起作用。

add_filter( 'woocommerce_get_price_html', 'custom_price_message' );
function custom_price_message( $price ) {
  $text = 'lorem';
  return $price . $text;
}
4

2 回答 2

4

我找到了答案,但它不会增加运费:

add_filter( 'woocommerce_cart_item_price', 'kd_custom_price_message' );
add_filter( 'woocommerce_cart_item_subtotal', 'kd_custom_price_message' );  
add_filter( 'woocommerce_cart_subtotal', 'kd_custom_price_message' );  
add_filter( 'woocommerce_cart_total', 'kd_custom_price_message' ); 

function kd_custom_price_message( $price ) {
    $afterPriceSymbol = ' TTC';
    return $price . $afterPriceSymbol;
}
于 2017-05-10T09:39:32.953 回答
1

对于运费:

add_filter( 'woocommerce_cart_shipping_method_full_label', 'kd_custom_price_message' );
于 2018-02-28T10:53:35.513 回答