Title: Applying CSS to PHP
Last modified: December 7, 2016

---

# Applying CSS to PHP

 *  [thenorth](https://wordpress.org/support/users/thenorth/)
 * (@thenorth)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/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)

 *  Plugin Support [Riaan K.](https://wordpress.org/support/users/riaanknoetze/)
 * (@riaanknoetze)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/applying-css-to-php/#post-8523566)
 * Would suggest using CSS instead of trying to add that with inline styles. Just
   grab the classname on the front end using Chrome’s dev tools, and then write 
   your own custom CSS.
 * As for the exact syntax, something along the lines of `font-size: 0.8em` should
   work just fine (Using `small` is a pretty outdated standard).
 *  [ThemeSumo](https://wordpress.org/support/users/themesumo/)
 * (@themesumo)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/applying-css-to-php/#post-8524784)
 * [@thenorth](https://wordpress.org/support/users/thenorth/) please provide a link
   to your site and show which elemenet you’re trying to style differently and I’ll
   provide you with some custom CSS code you can use.
 * As pointed out by Riaan above, if you right-click any part of your theme and 
   select the **Inspect Element** option, you can view the structure of your theme
   code.
 * Locate and click on the element you wish to change and you will be able to see
   the classname of that element to the right amongst the CSS code that is being
   applied to the selected element.
 * Hope this helps.
 *  Thread Starter [thenorth](https://wordpress.org/support/users/thenorth/)
 * (@thenorth)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/applying-css-to-php/#post-8525673)
 * Hi, part of the issue is the text doesn’t have a Class of it’s own. It’s linked
   to the price (which the proper ones aren’t. Can I give it a Class in PHP?
    The
   Prices I don’t create are this <small class=”woocommerce-price-suffix”>Inc VAT
   </small>
 * However the Prices created by the PHP above shows this ” inc VAT”.
 * Appreciate any help.
 * ![IMAGE of Website](https://postimg.org/image/mo31ivyy9/)
 * Thank you.
 *  [ThemeSumo](https://wordpress.org/support/users/themesumo/)
 * (@themesumo)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/applying-css-to-php/#post-8525795)
 * Try this:
 * `$suffix = '<small class="woocommerce-price-suffix">' . '&nbsp;inc VAT' . '</
   small>';`
 * Hope this helps.
    -  This reply was modified 9 years, 6 months ago by [ThemeSumo](https://wordpress.org/support/users/themesumo/).
 *  Thread Starter [thenorth](https://wordpress.org/support/users/thenorth/)
 * (@thenorth)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/applying-css-to-php/#post-8526048)
 * That is the shot. Thank you ThemeSumo.
 *  [ThemeSumo](https://wordpress.org/support/users/themesumo/)
 * (@themesumo)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/applying-css-to-php/#post-8526069)
 * No problem, good luck.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Applying CSS to PHP’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 6 replies
 * 3 participants
 * Last reply from: [ThemeSumo](https://wordpress.org/support/users/themesumo/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/applying-css-to-php/#post-8526069)
 * Status: not resolved