Applying CSS to PHP
-
Hi, I have some code to slightly change what Woo shows in my theme (basically for Multi Prices it shows “From £X).
However this removed the “inc VAT” label.
I have added some code and the inc VAT now shows (Suffix) but I need to apply the Font Size “Small” to it.How do I do this. Code is below.
Thanks in advance.
function wc_ninja_custom_variable_price( $price, $product ) { // Main Price $prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); $price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); // Sale Price $prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) ); sort( $prices ); $saleprice = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); $suffix = ' inc VAT'; if ( $price !== $saleprice ) { $price = '' . $saleprice . ' ' . $price . ''; } return $price . $suffix; } add_filter( 'woocommerce_variable_price_html', 'wc_ninja_custom_variable_price', 10, 2 );
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘Applying CSS to PHP’ is closed to new replies.