Update the quantity of the subscription.

@param int $quantity

@return $this
174320
public function updateQuantity(int $quantity)
    {
        $subscription = $this->asStripeSubscription();
        $subscription->quantity = $quantity;
        $subscription->prorate = $this->prorate;
        $subscription->save();

        $this->quantity = $quantity;
        $this->save();

        return $this;
    }
1130650
public function calculateTotal()
    {
        $this->calculateAdjustmentsTotal();

        $this->total = ($this->quantity * $this->unitPrice) + $this->adjustmentsTotal;

        if ($this->total < 0) {
            $this->total = 0;
        }

        return $this;
    }
817496
public function sub($quantity, $unit = null)
    {
        if ($unit === null) {
            $unit = $this->unit;
        }

        $quantity = new static($quantity, $unit, $this->currencyData);
        /** @var Currency $quantity */
        $quantity->to($this->unit);
        $this->value -= $quantity->getValue();
        return $this;
    }
859987
public function setQuantity($quantity) {
        if(!$this->setModified('quantity', $quantity)->isModified()) {
            return $this;
        }
		$this->quantity = $quantity;
		return $this;
    }
322198
public function skip(int $amount)
    {
        $this->items = array_slice($this->items, $amount);

        return $this;
    }
1284163
public function setQuantity( $quantity )
	{
		if( !is_numeric( $quantity ) ) {
			throw new MShop_Order_Exception( 'Quantity is invalid. Please enter a positive integer' );
		}

		$quantity = (int) $quantity;

		if( $quantity == $this->getQuantity() ) { return; }

		if( $quantity < 1 || $quantity > 2147483647 ) {
			throw new MShop_Order_Exception( sprintf( 'Quantity must be a positive integer and must not exceed %1$d', 2147483647 ) );
		}

		$this->_values['quantity'] = $quantity;
		$this->setModified();
	}
832402
public function update($slug, $qty): Manager
    {
        $cartProducts = $this->getSession();

        $cartProduct = $cartProducts->get($slug);

        if (null === $cartProduct) {
            throw new \Exception("Cart Product doesn't Exist");
        }
        $cartProduct->qty($qty);
        $cartProduct->lineTotal($qty * ($cartProduct->price() + $cartProduct->tax()));

        return $this;
    }
67436
public function update($subscriptions)
    {
        $this->initCollection();

        /** @var SubscriptionInterface $subscription */
        foreach ($subscriptions as $subscription) {
            $this->changeSubscription(
                $subscription,
                (bool)$subscription->getSubscriberStatus() === true ?
                    Subscriber::STATUS_SUBSCRIBED :
                    Subscriber::STATUS_UNSUBSCRIBED
            );
        }

        return $this->statusResponseFactory->create()
            ->setStatus('ok');
    }
1333136
def set_quantity(self, twig=None, value=None, **kwargs):
        
        # TODO: handle twig having parameter key (value@, default_unit@, adjust@, etc)
        # TODO: does this return anything (update the docstring)?
        return self.get_parameter(twig=twig, **kwargs).set_quantity(value=value, **kwargs)
1114409
public function setQuantity( $quantity )
	{
		if ( $quantity == $this->getQuantity() ) { return; }

		$this->_values['quantity'] = (int) $quantity;
		$this->setModified();
	}
437515
public function updateQuantity($quantity)
    {
        $quantity = max(0, $quantity - 1);

        $addonName = $this->braintree_plan.'-quantity';

        $options = ['remove' => [$addonName]];

        if ($quantity > 0) {
            $options = $this->quantity > 1
                ? ['update' => [['existingId' => $addonName, 'quantity' => $quantity]]]
                : ['add' => [['inheritedFromId' => $addonName, 'quantity' => $quantity]]];
        }

        BraintreeSubscription::update($this->braintree_id, ['addOns' => $options]);

        $this->quantity = $quantity + 1;

        $this->save();

        return $this;
    }
1306274
final public function limit(int $amount = null)
    {
        $this->limitAmount = $amount === null ? null : $amount;

        return $this;
    }
687652
public function saturate($amount)
    {
        if ($amount < 0 || $amount > 100) {
            throw new InvalidArgumentException('The given amount must be between 0 and 100');
        }
        $amount /= 100;
        $this->saturation += (100 - $this->saturation) * $amount;

        return $this;
    }
666603
public function setAddition($value)
    {
        $this->data->amount->subtotals->addition = $this->convertAmount($value);

        return $this;
    }
935621
public function limit(int $amount)
    {
        $this->items = array_slice($this->items, 0, $amount);

        return $this;
    }
812173
public function update($item_key, $quantity)
    {
        $item = $this
            ->items
            ->find("Key", $item_key);
        
        if ($item && !$item->Locked) {
            // If we need to track stock, do it now
            if ($item->Stocked || $this->config()->check_stock_levels) {
                $item->checkStockLevel($quantity);
            }

            $item->Quantity = floor($quantity);
            
            $this->extend("onBeforeUpdate", $item);
            
            $this->save();
        } else {
            throw new Exception(_t("Checkout.UnableToEditItem", "Unable to change item's quantity"));
        }

        return false;
    }
871466
public function setInventory(\Flowcode\ShopBundle\Entity\Inventory $inventory = null)
    {
        $this->inventory = $inventory;

        return $this;
    }