I need to know how I get the tax rate of an order. Currently I'm calculation this value with
$order->getShippingTaxAmount() and $order->getShippingAmount()
It's really, really ugly, but this works so far. But if there are no shipping cost, I don't get the tax rate. I need the rate for an ERP-system to do other tasks.
I've tried to use "var_dump()" for the order object and looked for my value by searching the tax rate, but can't find anything. Another idea was "get_class_methods", but also no luck.
I know, there is another thread (#6940246), but the solution works "global" - I need the tax rate of a specific order, which depends on country or customer - and should be historical.
You can use $tax_info = $order->getFullTaxInfo();
This method comes directly from the order Model. It will give you an array containing detailed tax information for that order, including amount, tax code, title, tax id, percent.
To recieve e.g. the tax rate in percent, you can then use $tax_rate = $tax_info[0]['percent'];