Tax of the item.

@param string|double $tax

@return $this
9403
public function setTax($tax)
    {
        NumericValidator::validate($tax, "Tax");
        $tax = Formatter::formatToPrice($tax, $this->getCurrency());
        $this->tax = $tax;
        return $this;
    }
764401
def add_taxes(self, taxes):
        
        # fixme: how to resolve duplicate tax names
        _idx = len(self.taxes)  # current index to prevent overwriting
        for idx, tax in enumerate(taxes):
            tax_key = "tax_" + str(idx + _idx)
            self.taxes[tax_key] = {"name": tax[0], "amount": tax[1]}
1092375
public function subTotal($format = true, $withDiscount = true, $taxedItemsOnly = false, $withTax = false)
    {
        $total = $this->price(false, $taxedItemsOnly) * $this->qty;

        if ($withDiscount) {
            $total -= $this->getDiscount(false);
        }

        if ($total < 0) {
            $total = 0;
        }

        if ($withTax) {
            $total += $this->tax(0, false, false, $withDiscount);
        }

        return LaraCart::formatMoney($total, $this->locale, $this->internationalFormat, $format);
    }
1113113
public function add(Item $item)
    {
        foreach ($this->filters as $filter) {
            $this->applyFilter($filter, $item);
        }

        $this->items[] = $item;

        return $this;
    }
585133
public function remove($item)
    {
        if ($item->parent() === $this->parentNode) {
            $this->checkUnlocked($item);
            $item->internalUnsetParent();
            parent::remove($item);
        }

        return $this;
    }
415563
public function getTotalTaxAmount()
    {
        // Convert to minor units for more accurate calculations
        $total_amount = CurrencyUtils::amountToExponent($this->getTotalAmount(), $this->currency);
        $tax_rate     = CurrencyUtils::amountToExponent($this->tax_rate, $this->currency);

        $total_tax_amount = ceil(
            $total_amount - ( ($total_amount * 10000) / (10000 + $tax_rate) )
        );

        return CurrencyUtils::exponentToAmount($total_tax_amount, $this->currency);
    }
1357755
public function tax($amount = null)
    {
        if (null === $amount) {
            return $this->tax;
        }

        $this->tax = $amount;

        return $this;
    }
497361
public function setItems($items)
    {
        $this->items = array();

        foreach ($items as $item) {
            $this->addItem($item);
        }

        return $this;
    }
1268295
public function setCurrency(string $currency): self
    {
        $this->isValidCurrency($currency);

        $this->currency = $currency;

        return $this;
    }
1006117
def tax_for_order(self, order_deets):
        """"""
        request = self._post('taxes', order_deets)
        return self.responder(request)
926348
public function setTaxPercentage($tax_percentage) : CNabuDataObject
    {
        if ($tax_percentage === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$tax_percentage")
            );
        }
        $this->setValue('nb_commerce_product_tax_percentage', $tax_percentage);
        
        return $this;
    }
1079564
public function addItem($item)
    {
        if (!is_numeric($item)) {
            throw new \InvalidArgumentException(sprintf("Value '%s' must be a numeric value", $item));
        }

        $this->items[] = $item;

        return $this;
    }
1353393
public function addItem(Item $item)
    {
        if (!$this->items->contains($item)) {
            $this->items->add($item);
            $item->setType($this);
        }

        return $this;
    }
732759
public function setTaxAmount($tax_amount) : CNabuDataObject
    {
        if ($tax_amount === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$tax_amount")
            );
        }
        $this->setValue('nb_commerce_product_tax_amount', $tax_amount);
        
        return $this;
    }
995996
public function create()
    {
        /**
         * @var Tax $tax
         */
        $classNamespace = $this->getEntityNamespace();
        $tax = new $classNamespace();
        $tax
            ->setName('')
            ->setDescription('')
            ->setValue(0)
            ->setEnabled(false);

        return $tax;
    }
705282
public function setTotal($total)
    {
        NumericValidator::validate($total, "Total");
        $total = Formatter::formatToPrice($total, $this->getCurrency());
        $this->total = $total;
        return $this;
    }
1337919
protected function getUrlTrackEcommerce($grandTotal, $subTotal = 0.0, $tax = 0.0, $shipping = 0.0, $discount = 0.0)
    {
        if (!is_numeric($grandTotal)) {
            throw new Exception("You must specifiy a grandTotal for the Ecommerce order (or Cart update)");
        }

        $url = $this->getRequest($this->idSite);
        $url .= '&idgoal=0';
        if (!empty($grandTotal)) {
            $grandTotal = $this->forceDotAsSeparatorForDecimalPoint($grandTotal);
            $url .= '&revenue=' . $grandTotal;
        }
        if (!empty($subTotal)) {
            $subTotal = $this->forceDotAsSeparatorForDecimalPoint($subTotal);
            $url .= '&ec_st=' . $subTotal;
        }
        if (!empty($tax)) {
            $tax = $this->forceDotAsSeparatorForDecimalPoint($tax);
            $url .= '&ec_tx=' . $tax;
        }
        if (!empty($shipping)) {
            $shipping = $this->forceDotAsSeparatorForDecimalPoint($shipping);
            $url .= '&ec_sh=' . $shipping;
        }
        if (!empty($discount)) {
            $discount = $this->forceDotAsSeparatorForDecimalPoint($discount);
            $url .= '&ec_dt=' . $discount;
        }
        if (!empty($this->ecommerceItems)) {
            $url .= '&ec_items=' . urlencode(json_encode($this->ecommerceItems));
        }
        $this->ecommerceItems = array();

        return $url;
    }