sumByTax example

namespace Shopware\Components\Cart;

use Shopware\Components\Cart\Struct\Price;

class ProportionalTaxCalculator implements ProportionalTaxCalculatorInterface
{
    /** * {@inheritdoc} */
    public function calculate($discount$prices$isNetPrice)
    {
        $sumByTaxes = $this->sumByTax($prices);

        $total = array_sum($sumByTaxes);

        $taxes = [];

        foreach ($sumByTaxes as $taxRate => $price) {
            $taxRate = (float) $taxRate;

            if ((float) $price === 0.0) {
                $taxes[] = new Price(0.0, 0.0, $taxRate, 0.0);
                continue;
            }
Home | Imprint | This part of the site doesn't use cookies.