/** * Check if the requested amount is available for the product * * @param \XLite\Model\OrderItem $item Order item to add * @param integer $amount Amount to check OPTIONAL * * @return integer */ protected function checkAmount(\XLite\Model\OrderItem $item, $amount = null) { return $item->getVariant() && !$item->getVariant()->getDefaultAmount() ? ($amount ?: 0) < $item->getVariant()->getAvailableAmount() : parent::checkAmount($item, $amount); }