cancel
Showing results for 
Search instead for 
Did you mean: 

Get final price including tax grouped products Magento 2.3.2

Get final price including tax grouped products Magento 2.3.2

I am trying to get the total price of grouped products and have used this code and created this file:

MyCustomTheme/Magento_GroupedProduct/templates/product/price/final_price.phtml

 

<?php

/*
 * Show combined price instead of minimal price for grouped products.
 */

$products = $block->getSaleableItem()->getTypeInstance()->getAssociatedProducts($block->getSaleableItem());

$priceForAll = 0;
foreach ($products as $product) {
$priceForAll += $product->getFinalPrice();
}

?>

<div class="price-box price-final_price" data-role="priceBox" data-product-id="284">
<span class="price-container price-final_price tax weee">
        <span id="product-price-284" data-price-amount="<?php echo $priceForAll?>" data-price-type="finalPrice" class="price-wrapper ">
            <span class="price"><?php echo number_format($priceForAll,2,',','.')?></span>
        </span>
</span>
</div>

But the problem is that price is displayed without tax:

 

Product_sum.png

 

Any suggestions on how i can get the price including tax instead?

Total price here should be 3755,- not 3004,-

 

3 REPLIES 3

Re: Get final price including tax grouped products Magento 2.3.2

Did you ever find a solution to this, I have the same issue.

Re: Get final price including tax grouped products Magento 2.3.2

Yes, actually i did. I used a module from SolideWebservices released in GitHub and modified it, you can find the files here:

https://www.dropbox.com/sh/ezyphixnzr4c7kp/AADwHCzH8-xbxWvDcxTs3rgga?dl=0

Hope it helps Smiley Happy

Re: Get final price including tax grouped products Magento 2.3.2

Hi Robert, 

 

Sorry to bother you but i'm facing the same issue as you. I've added the code you've showed but i get the price without tax. If you could share your code with the solution that would be great. 

 

Thank you in advance for your help.

 

Regards, 

Sidney