public function taxTotal($format = true, $withFees = true, $grossTaxes = true)
    {
        $totalTax = 0;
        $discounted = 0;
        $totalDiscount = $this->totalDiscount(false, false);

        if (config('laracart.discountsAlreadyTaxed', false)) {
            $totalDiscount = 0;
        }

        if ($this->count() != 0) {
            /**
             * @var
             * @var CartItem $item
             */
            foreach ($this->getItems() as $index => $item) {
                if ($discounted >= $totalDiscount) {
                    $totalTax += $item->tax(null, $grossTaxes);
                } else {
                    $itemPrice = $item->subTotal(false, config('laracart.discountTaxable', false));
                    if (($discounted + $itemPrice) > $totalDiscount) {
                        $totalTax += config('laracart.discountTaxable', false) ? $item->tax() : $item->tax($totalDiscount - $discounted);
                    }

                    $discounted += $itemPrice;
                }
            }
        }

        if ($withFees) {
            foreach ($this->getFees() as $fee) {
                if ($fee->taxable) {
                    $totalTax += $fee->amount * $fee->tax;
                }
            }
        }

        return $this->formatMoney($totalTax, null, null, $format);
    }
public function taxTotal($format = true, $withFees = true, $grossTaxes = true)
    {
        $totalTax = 0;
        $discounted = 0;
        $totalDiscount = $this->totalDiscount(false, false);

        if (config('laracart.discountsAlreadyTaxed', false)) {
            $totalDiscount = 0;
        }

        if ($this->count() != 0) {
            /**
             * @var
             * @var CartItem $item
             */
            foreach ($this->getItems() as $index => $item) {
                if ($discounted >= $totalDiscount) {
                    $totalTax += $item->tax(null, $grossTaxes);
                } else {
                    $itemPrice = $item->subTotal(false, config('laracart.discountTaxable', false));
                    if (($discounted + $itemPrice) > $totalDiscount) {
                        $totalTax += config('laracart.discountTaxable', false) ? $item->tax() : $item->tax($totalDiscount - $discounted);
                    }

                    $discounted += $itemPrice;
                }
            }
        }

        if ($withFees) {
            foreach ($this->getFees() as $fee) {
                if ($fee->taxable) {
                    $totalTax += $fee->amount * $fee->tax;
                }
            }
        }

        return $this->formatMoney($totalTax, null, null, $format);
    }
public function taxTotal ( $ format = true , $ withFees = true , $ grossTaxes = true ) { $ totalTax = 0 ; $ discounted = 0 ; $ totalDiscount = $ this -> totalDiscount ( false , false ) ; if ( config ( 'laracart.discountsAlreadyTaxed' , false ) ) { $ totalDiscount = 0 ; } if ( $ this -> count ( ) != 0 ) { /**
             * @var
             * @var CartItem $item
             */ foreach ( $ this -> getItems ( ) as $ index => $ item ) { if ( $ discounted >= $ totalDiscount ) { $ totalTax += $ item -> tax ( null , $ grossTaxes ) ; } else { $ itemPrice = $ item -> subTotal ( false , config ( 'laracart.discountTaxable' , false ) ) ; if ( ( $ discounted + $ itemPrice ) > $ totalDiscount ) { $ totalTax += config ( 'laracart.discountTaxable' , false ) ? $ item -> tax ( ) : $ item -> tax ( $ totalDiscount - $ discounted ) ; } $ discounted += $ itemPrice ; } } } if ( $ withFees ) { foreach ( $ this -> getFees ( ) as $ fee ) { if ( $ fee -> taxable ) { $ totalTax += $ fee -> amount * $ fee -> tax ; } } } return $ this -> formatMoney ( $ totalTax , null , null , $ format ) ; }
Gets the total tax for the cart.

@param bool|true $format
@param bool|true $withFees
@param bool      $grossTaxes

@return string
Gets the total tax for the cart .