How to Export Net Sales Amount in WooCommerce
When you are exporting from WooCommerce you need access to all the data in the system. With our plugin you can get access to pretty much every piece data.
In this example we’ll show you how to create an export that includes the Net Sales Amount.
What is Net Sales Amount?
The Net Sales Amount is basically the total order total with the tax removed. WooCommerce provides the gross sales amount (including tax).
For example you could have a cart that has the following values:
Total Sales: 42.79
Sales Tax: 2.80
Net Sales = 39.99
Adding An Extra Field
To export our data we will take advantage of the customization feature of our plugin – you can read more about it here in our article How to Customize Your Export.
The first thing we will do is add a new field – we’ll call it net_sales
Note that we have selected the “Custom Fields” and IMPORTANTLY the Column ID is net_sales
Adding the Code
Now we will add the code. This is done in the Report Format & Output section
Here is the code you need to enter
add_filter(‘jem_export_field_net_sales’,’jem_net_sales_callback’,10,3);
function jem_net_sales_callback($value,$order_details,$item){
$data = $order_details->get_data();
$net = $data[‘total’] – $data[‘cart_tax’] – $data[‘shipping_tax’];
return $net;
}
Summary
As you can see it is incredibly easy to add new fields to you export – good luck!