How to change the font size in php?

Viewed 58

I'm trying to change the font size of the price including tax, not just the suffix 'incl. btw'. Is it possible to do that?

add_filter( 'woocommerce_get_price_suffix', 'bbloomer_add_price_suffix_price_inc_tax', 99, 4 );
       
function bbloomer_add_price_suffix_price_inc_tax( $suffix, $product, $price, $qty ){
    $suffix = ' excl. btw <br> ' . wc_price( wc_get_price_including_tax( $product ) ) . ' incl.btw';
    return $suffix;
}
1 Answers

As mentioned above you can use a span to control the font attributes. Like this

function bbloomer_add_price_suffix_price_inc_tax( $suffix, $product, $price, $qty ){
    $suffix = ' excl. btw <br> ' . 
              '<span style="font-size: large">'.
              wc_price( wc_get_price_including_tax( $product ) ) . ' incl.btw'.
              '</span>';
    return $suffix;
}

The code above is formatted for clarity. It shows the font as large, but you can use pixels or other units. That font size (or other attributes are only in-force within the span.

Related