woocommercesuffix

How to add suffix text to price in WooCommerce cart and checkout page?


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

Solution

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