# Add to cart very slow

**URL:** <https://forum.wixstudio.com/t/add-to-cart-very-slow/39198>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [July 1, 2022, 11:38pm UTC](https://forum.wixstudio.com/t/add-to-cart-very-slow/39198 "2022-07-01T23:38:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![huihaoch](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/huihaoch/32/30180_2.png) [@huihaoch](https://forum.wixstudio.com/u/huihaoch)\
**Post date:** [July 1, 2022, 11:38pm UTC](https://forum.wixstudio.com/t/add-to-cart-very-slow/39198/1 "2022-07-01T23:38:15Z")

</div>

I tried

```javascript
addToCart and addProducts

```

The Promises pending time and very slow. After I clicked the Add to Cart Button, I need to wait 8-10 seconds for the product to appear on the mini-cart. Does anyone know why?

function getProductDetails() {  
$w(“#productPage1”)  
.getProduct()  
.then((productInfo) =\> {  
setProductTextInfo(productInfo);  
$w(“#addcartbtn”).onClick(()=\>{  
console.log(“add to cart”)

```
    if(Number.isInteger(parseFloat($w('#quantityInput').text))) {
        
        $w("#shoppingCartIcon1").addToCart(productInfo._id, quantity, {"choices": productOptions, "customTextFields": []})
        .then(() => {console.log("added");}).catch(e=>console.log(e))
   }
});

$w("#addbutton").onClick(()=>{
  let result = parseInt($w("#quantityInput").text ) + 1;
  if(result <= 50) {
    $w("#quantityInput").text = (parseInt($w("#quantityInput").text ) + 1).toString();
  // console.log( (parseInt($w("#quantityInput").text ) + 1).toString());
  }
  
});
 $w("#minusbutton").onClick(()=>{
  let result = parseInt($w("#quantityInput").text ) - 1;
  if(result > 0) {
     $w("#quantityInput").text = (parseInt($w("#quantityInput").text) - 1).toString();
  }
});

```

})  
.catch((error) =\> {  
console.error(error);  
});  
}

---

<div class="post-metadata">

**Author:** ![huihaoch](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/huihaoch/32/30180_2.png) [@huihaoch](https://forum.wixstudio.com/u/huihaoch)\
**Post date:** [July 1, 2022, 11:42pm UTC](https://forum.wixstudio.com/t/add-to-cart-very-slow/39198/2 "2022-07-01T23:42:11Z")

</div>

I tried to contract customer support. They didn’t know why either. The checkout Button is also very slow

---

<div class="post-metadata">

**Author:** ![dhansites](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/dhansites/32/8905_2.png) [@dhansites](https://forum.wixstudio.com/u/dhansites)\
**Post date:** [November 23, 2022, 7:02am UTC](https://forum.wixstudio.com/t/add-to-cart-very-slow/39198/3 "2022-11-23T07:02:00Z")

</div>

use this instead / not a good solution in terms of speed / but little better  
Also they’re investigating this issue from last few years / i have no idea when solution will be provided

```
            cart . addProducts ( products ) 
             navigate . toCart () 
                . then (() => { 
                }) 
                . **catch** (( error ) => { 
                    console . log ( error ); 
                })

```
