Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

Add tax class in pdf invoice

Add the below code in the functions.php file of your active theme –
add_filter (‘mvx_vendor_get_order_item_totals’, ‘add_tax_class_name’, 10, 2);
function add_tax_class_name($order_item_totals, $order) {
$order_taxes = $order->get_taxes();
$tax_classes = WC_Tax::get_tax_classes();
$classes_options = wc_get_product_tax_class_options();
if (!empty($order_taxes)) :
foreach ($order_taxes as $tax_id => $tax_item) :
$tax_class = wc_get_tax_class_by_tax_id($tax_item[‘rate_id’]);
$tax_class_name = isset($classes_options[$tax_class]) ? $classes_options[$tax_class] : __(‘Tax’, ‘multivendorx’);
$order_item_totals[‘tax_class’] = array(
‘label’ => __(‘Tax class:’, ‘multivendorx’),
‘value’ => $tax_class_name
);
endforeach;
endif;
return $order_item_totals;
}

Leave a Reply