Add Individual Item To Cart

We can add individual item to cart from the wishlist

 addIndividualItemToCart: function(e){
          e.preventDefault();
          var self = this;
          var itemid = this.$(e.target).data('id')
          var array = self.model.get('items').models;
          var foundIndex = array.findIndex((el) => (el.id == itemid));
          var item = array[foundIndex]
          var add_to_cart_promise = this.cart.addProduct(item);

          add_to_cart_promise.then(function() {
          self.unselectAll();
          self.showConfirmationHelper();
               });
                
         this.disableElementsOnPromise(add_to_cart_promise);
     },

Leave a comment

Your email address will not be published. Required fields are marked *