Guest User

Untitled

a guest
Jan 16th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. if($QuantityToAdd > $ProductStock){
  2. // throw error
  3. }
  4. else{
  5. // add to cart
  6. }
  7.  
  8. if(($QuantityToAdd + $QuantityInCart) > $ProductStock){
  9. // throw error
  10. }
  11. else{
  12. // add to cart
  13. }
  14.  
  15. if ($this->checkoutSession->create()->getQuote()->hasProductId($productId)) {
  16. //product is available in the cart
  17. }
  18.  
  19. $this->cart->addProduct($productToadd, $params);
Add Comment
Please, Sign In to add comment