function cw_change_product_price_display( $price ) {
$user = wp_get_current_user();
if ( in_array( 'subscriber', $user->roles, true ) ) {
$text = 'text for user subscriber';
} elseif ( in_array( 'administrator', $user->roles, true ) ) {
$text = 'text for user administrator';
} elseif ( in_array( 'editor', $user->roles, true ) ) {
$text = 'text for user editor';
} elseif ( in_array( 'author', $user->roles, true ) ) {
$text = 'text for user author';
} elseif ( in_array( 'contributor', $user->roles, true ) ) {
$text = 'text for user contributor';
} else {
$text = 'default text';
}
$price .= sprintf( '<span style="color: #8e8181;font-size: 13px;">%s</span>', $text );
return $price;
}
add_filter( 'woocommerce_get_price_html', 'cw_change_product_price_display' );
add_filter( 'woocommerce_cart_item_price', 'cw_change_product_price_display' );