Thread Starter
wrtom
(@wrtom)
the problem is in the costbyregion.php
your plugin thinks the cost by region is the net price. but we have gross prices in the shop.
wrong:
if ( Shipping_Settings::costByRegionTaxable() ) {
$taxes = FunctionsHelperPro::calculateShippingCostTaxes( (float) $region_cost );
$rate->taxes = $taxes;
}
correct with 7% tax f.e.:
if ( Shipping_Settings::costByRegionTaxable() ) {
$brutto = (float) $region_cost; // Annahme: Das ist der Bruttobetrag
$tax_rate = 7.0;
$netto = round($brutto / (1 + ($tax_rate / 100)), 2);
$steuer = round($brutto – $netto, 2);
$wc_taxes = \WC_Tax::get_shipping_tax_rates();
$first_tax_rate_id = array_key_first($wc_taxes);
$taxes = array(
$first_tax_rate_id => $steuer
);
$rate->cost = $netto;
$rate->taxes = $taxes;
}