I'm using the following code to add a custom fee based on payment method:
function stackoverflow_apply_payment_gateway_fee() {
$payment_method = WC()->session->get( 'chosen_payment_method' );
if( $payment_method == 'paypal' ) {
$label = 'PayPal Fee <span>HTML</span>';
$cart_subtotal_fee = WC()->cart->get_subtotal();
$amount = 5;
WC()->cart->add_fee( $label, $amount, true, 'standard' );
}
}
add_action( 'woocommerce_cart_calculate_fees', 'stackoverflow_apply_payment_gateway_fee' );
I want to show an icon next to the label using HTML, like this:
$label = 'PayPal Fee <span>HTML</span>';
However string will be (esc_html) escaped for HTML tags. How can I make it work with HTML tags to show my icon?