3

I need to add a text mention after prices (sub-total, total...) displayed in my cart page and checkout page.

I know how to do that on single page and shop page but not on the other pages. The only thing I found is this code, but it does not work.

add_filter( 'woocommerce_get_price_html', 'custom_price_message' );
function custom_price_message( $price ) {
  $text = 'lorem';
  return $price . $text;
}
halfer
  • 19,824
  • 17
  • 99
  • 186

3 Answers3

5

I found the answer but it does not add to shipping price:

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;
}
1

For shipping price :

add_filter( 'woocommerce_cart_shipping_method_full_label', 'kd_custom_price_message' );
halfer
  • 19,824
  • 17
  • 99
  • 186
Arthur M
  • 53
  • 1
  • 5
0
add_filter( 'woocommerce_cart_item_price', 'cw_change_product_price_display' );
function cw_change_product_price_display( $price ) {
    $text = __(' X ');
    return $price . ' ' . $text;
}

For cart page you can try this code.

Mervin
  • 26
  • 4