update() public method

Update an item in the cart.
public update ( string $itemId, string $key, mixed $value ) : string
$itemId string
$key string
$value mixed
return string
Beispiel #1
0
 /**
  * @param Cart   $cart
  * @param string $cartItemId
  * @param int    $amount
  */
 protected function handlePOSTUpdateAmount($cart, $cartItemId, $amount)
 {
     if (!$cart->has($cartItemId)) {
         return;
     }
     if ($amount === 0) {
         $cart->remove($cartItemId);
     } else {
         $cart->update($cartItemId, 'quantity', intval($amount));
     }
 }