I am using WooCommerce on my Wordpress site and I want to display the total price per product in my cart/minicart (e.g.: 'Product Quantity' x 'Product Price' = 'Product Total Price'). The code I am using right now is working, but there are rounding errors.
Expected:
- Product #1
- Quantity: 2
- Price: 3,50
- Total Price: 7,00
Displayed:
- Product #2
- Quantity: 2
- Price: 3,50
- Total Price: 6,00
Here is the code I am using:
<?php $new_product_price_old = number_format((float)wp_kses( woocommerce_price( $_product->get_price() ), array() ) * $cart_item['quantity'], 2, ',', '.'); ?>
<?php echo '<span class="sidecart-item-price">' . $new_product_price ?> <span class="woocommerce-Price-currencySymbol">€</span></span>
Is there a simple way to fix this or maybe another piece of code? Or a hook I am missing? Total beginner here...
Thanks in advance