Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($QuantityToAdd > $ProductStock){
- // throw error
- }
- else{
- // add to cart
- }
- if(($QuantityToAdd + $QuantityInCart) > $ProductStock){
- // throw error
- }
- else{
- // add to cart
- }
- if ($this->checkoutSession->create()->getQuote()->hasProductId($productId)) {
- //product is available in the cart
- }
- $this->cart->addProduct($productToadd, $params);
Add Comment
Please, Sign In to add comment