Title: Checking a variable in functions.php from external file
Last modified: August 21, 2016

---

# Checking a variable in functions.php from external file

 *  [kieranmcclung](https://wordpress.org/support/users/kieranmcclung/)
 * (@kieranmcclung)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/checking-a-variable-in-functionsphp-from-external-file/)
 * Hello,
 * I’ve been looking through the forum but I haven’t managed to see anything that
   is helping. What I have is a function that changes tax rate for woocommerce on
   an if statement. _See below_
 *     ```
       // Woocommerce Commercial / Domestic VAT rate
       add_filter('woocommerce_product_tax_class', 'big_apple_get_tax_class', 1, 2);
   
       function big_apple_get_tax_class($tax_class, $product, $vat) {
          global $woocommerce;
   
          if ($woocommerce->cart->subtotal <= 110)
             $tax_class = 'Reduced Rate';
   
          return $tax_class;
       }
       ```
   
 * What I need to do is change that if to:
 *     ```
       if ($vat == 1)
             $tax_class = 'Reduced Rate';
   
          return $tax_class;
       ```
   
 * That $vat variable is stored in php file in the woocommerce directory, completely
   outside the functions.php file. Is there any way to get the value of that variable
   into the function at all? I’m trying to think of other ways to do this and didn’t
   know whether, in the woocommerce file, I could add an if saying
 *     ```
       if ($vat == 1)
           [load function]
       ```
   
 * or something to that affect. Any help is greatly appreciated.
 * Thank you.

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/checking-a-variable-in-functionsphp-from-external-file/#post-4098975)
 * please post in [http://wordpress.org/support/plugin/woocommerce](http://wordpress.org/support/plugin/woocommerce)
 *  Thread Starter [kieranmcclung](https://wordpress.org/support/users/kieranmcclung/)
 * (@kieranmcclung)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/checking-a-variable-in-functionsphp-from-external-file/#post-4099072)
 * Apologies for posting in the incorrect area. I was seeing it as a more general
   issue rather than woocommerce specific but hopefully someone in the woocommerce
   area knows of a better way of doing this.
 * Thank you.

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

The topic ‘Checking a variable in functions.php from external file’ is closed to
new replies.

## Tags

 * [function](https://wordpress.org/support/topic-tag/function/)
 * [functions](https://wordpress.org/support/topic-tag/functions/)
 * [variable](https://wordpress.org/support/topic-tag/variable/)
 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * 2 replies
 * 2 participants
 * Last reply from: [kieranmcclung](https://wordpress.org/support/users/kieranmcclung/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/checking-a-variable-in-functionsphp-from-external-file/#post-4099072)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
