Reputation: 11
how can i programmatically get the shipping tax from an order increment_id in magento?
I try this script, but seems not to work.
$order = Mage::getModel('sales/order')->loadByIncrementId("increment_id");
$taxRefunded = $order->getTaxRefunded();
Thanks
Upvotes: 1
Views: 2086
Reputation: 8050
You can retrieve tax information from order with following code, returning an array. You can parse and use this array to get the shipping tax ammount.
$order = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('increment_id', 100000166)->getFirstItem();
$taxRefunded = $order->getFullTaxInfo();
var_dump($taxRefunded);
E.g.: to retrieve tax percent:
$tax_percent = $taxRefunded[0]['percent'];
Upvotes: 2