Adding Total_Tax to a WooCommerce Order details function (in PHP)

I have a custom snippet in my [login to view URL] which creates an XML of each WooCommerce order. It currently just spits out the customer details, items and total amount. I need to add tax to the function.

A preview of the snippet is below. I need to add tax (either per item, or total_tax per order) to this.

$xml .= "<items>\n";

foreach ($order_obj->get_items() as $item_id => $item_data) {

$product = $item_data->get_product();

$product_sku = $product->get_sku();

$product_quantity = $item_data->get_quantity();

$product_total = $item_data->get_total();

$order_shipping_tax = $order_data['shipping_tax'];

$order_total = $order_data['cart_tax'];

$order_total_tax = $order_data['total_tax'];

$xml .= "<item>\n";

$xml .= "<item-num>" . htmlspecialchars($product_sku) . "</item-num>\n";

$xml .= "<quantity>" . htmlspecialchars($product_quantity) . "</quantity>\n";

$xml .= "<price>" . htmlspecialchars($product_total) . "</price>\n";

$xml .= "</item>\n";


$xml .= "</items>\n";

Skills: PHP, WordPress, WooCommerce

See more: woocommerce get all orders by user id, woocommerce order details plugin, get_formatted_order_total, woocommerce get order items, woocommerce get order details after checkout, get order id woocommerce, get_formatted_billing_address, wc_order_item_product, mail order details php, php mail message order details, php mail message dynamic order details, virtuemart total tax, create sql database customer order details code, php email order details, paypal order details php, order details php mysql, order details form php, parse amazon order details php, prestashop adding additional information order details, order details php dreamweaver

About the Employer:
( 3 reviews ) Warsaw, Poland

Project ID: #25363900

Awarded to:


Hello, Client. I have rich experience with website development using Wordpress. I read through the job details extremely carefully and I am absolutely sure that I can do the project very well. Please feel free to conta More

$20 USD in 1 day
(6 Reviews)

3 freelancers are bidding on average $17 for this job


Greetings, I have gone through your project details as i can fix to add tax as well and I can start now your work . I have more than 10 yrs. of experience . Please come to chat for more discussion. My Skills: Shopify , More

$20 USD in 1 day
(62 Reviews)

Hi ! I want to discuss more about this i read your all requirements i have 4 years experience. I can complete your project on time and within your budget. I have worked on similar projects to what you are looking for, More

$10 USD in 3 days
(4 Reviews)