Add to cart very slow

I tried

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);
});
}

2 Likes

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

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 ); 
                })