В Woocommerce я создал собственную корзину с другим рассчитанным налогом и новой общей суммой.
Как я могу отправить электронное письмо с этими новыми данными?
В каком файле Woocommerce?
<?php
global $woocommerce;
$items = $woocommerce->cart->get_cart();
foreach($items as $item => $values) {
$product =wc_get_product( $values['data']->get_id());
echo "<b>".$product->get_title().'</b><br> Quantità: '.$values['quantity'].'<br>';
$price = get_post_meta($values['product_id'] , '_price', true);
echo "Prezzo: ".$price."<br>";
$carrello = $values['quantity'] * $price;
echo "Totale: ".$carrello."<br>";
// Below the new data with tax and discount calculation:
$percent = ($tax_amount / $without_tax) * 100;
if ($percent == "10")
$tax_rate = 10;
else $tax_rate= 4;
$with_tax = $scontato;
$totaleforsebene = ($scontato * $percent)/100;
$totalForSebeneArray[$values['data']->get_id()] = $totaleforsebene; // add the value by the item ID
$totaleforsebene = number_format($totaleforsebene, 2, '.', '')." €";
}
?>
<th>Iva<br />Totale chiusura</th>
<td>
<?php
$totaleiva_1 = 0;
$items = $woocommerce->cart->get_cart();
foreach($items as $item ) {
$totaleiva_1 += $totalForSebeneArray[$item ['data']->get_id()];
}
$totaleiva_1 = number_format($totaleiva_1, 2, '.', '');
echo "€"; echo $totaleiva_1;
echo "<br>";
$totalefinitocarrello = $totaleiva_1 + $total;
echo "€"; echo $totalefinitocarrello;
?></td></tr>
<?php endif; ?>