- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good Morning,
I am stuck here with the following problem:
For an invoice-object I need all tax-percentages, tax-amounts and
total without tax that were processed within this invoice
Eg:
20%, 5€, 25€
10%,5€,50€
0%,0€,100€
...
How can I achieve that? is there any documentation about the classes in Magento2?
For the moment it is just trial and error for me
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Let's example you have invoice item and object name for invoice item is $invoiceItem
echo $invoiceItem->getOrderItem()->getTaxPercent()
By above code you will get Percentage for specific item.
If it will work or help you then mark as solution
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to get tax listing from invoice object
Hello,
Hope you have invoice object
let's example your invoice object name is $invoice
echo $invoice->getTaxAmount();
above code for get Tax value from invoice
echo $invoice->getBaseGrandTotal();
above code get base total.
for percentage you will get from all invoice item.
Hope it will work for you.
If it will help you, then mark as solution
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to get tax listing from invoice object
So far so good, but my problem is, that we have different taxes for
different kinds of goods. So one invoice can contain different items with
different tax percentages.
Is there a way to get an array with tax percentages and totals for each tax
percentages?
Regards,
Gunther
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Let's example you have invoice item and object name for invoice item is $invoiceItem
echo $invoiceItem->getOrderItem()->getTaxPercent()
By above code you will get Percentage for specific item.
If it will work or help you then mark as solution
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to get tax listing from invoice object
is that work for you?
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to get tax listing from invoice object
@kornblumenapo, you can loop all the items of invoice object and create an array for tax percentage based on product if or sku & then do rest calculation.$taxes
$taxes = []; foreach ($invoice->getAllItems() as $item) { $taxes[$item->getProductId()] = $item->getTaxPercent(); }
Then in $taxes, you will get taxes for each product id.