Title: Conditionally change values
Last modified: April 9, 2020

---

# Conditionally change values

 *  [PossiblyMaybe](https://wordpress.org/support/users/possiblymaybe/)
 * (@possiblymaybe)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/conditionally-change-values/)
 * Hi there,
 * Great plugin! I am trying to use it to create a csv file that I can import in
   to Sage 50 accounting software.
 * There are a few bits I am stuck on. Firstly I need a field for the Tax Rate, 
   on each product in the order, and the shipping. But I can’t find the meta for
   _tax_rate or _tax_class. Or have I got them wrong?
 * Also I then need to output these in a Sage format (eg. if the tax rate is 20%
   it will output as “T1” and if the rate is 0% it will output “T0”, etc.
 * Is any of this possible?
 * Many thanks!

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

 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/conditionally-change-values/#post-12651782)
 * Hello
 * you can use field “Item tax rate” , section >Setup fields>Product items.
 * to use T0/T1 – add following code to section “Misc Settings”
    thanks, Alex
 *     ```
       //convert to Sage values
       add_filter('woe_fetch_order_products', function ($products,$order,$labels, $format, $static_vals) {
        foreach($products as $k=>$product) { 
            if($product['tax_rate'] == 0 ) $products[$k]['tax_rate'] = "T0";
            if($product['tax_rate'] == 20 ) $products[$k]['tax_rate'] = "T1";
        }
        return $products;
       }, 100, 5);
       ```
   
 *  Thread Starter [PossiblyMaybe](https://wordpress.org/support/users/possiblymaybe/)
 * (@possiblymaybe)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/conditionally-change-values/#post-12651931)
 * Wow thanks so much, a quicker and better reply than I expected!
 * So glad you have code ready for Sage 50 as I might have another question or two
   as I try to set this up.
 * Another one is the Sage field ‘Type’ with either SI or SC (Sale Invoice or Sales
   Credit (refund)), is there a way to output these?
 * Thanks!
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/conditionally-change-values/#post-12652338)
 * please, upload sample Excel to [https://algolplus.freshdesk.com/](https://algolplus.freshdesk.com/)
 * you should upload your settings too, use tab Tools to get them

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

The topic ‘Conditionally change values’ is closed to new replies.

 * ![](https://ps.w.org/woo-order-export-lite/assets/icon-256x256.png?rev=1365554)
 * [Advanced Order Export For WooCommerce](https://wordpress.org/plugins/woo-order-export-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-order-export-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-order-export-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-order-export-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-order-export-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-order-export-lite/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [algol.plus](https://wordpress.org/support/users/algolplus/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/conditionally-change-values/#post-12652338)
 * Status: not resolved