score:1

just had to reset the doc :

befor : 

 const emptycart = async () => {
            await userdoc.delete()
            await updatecart()
            await updatestore()
        }

after : 


 const emptycart = async () => {
        const userdoc = await firebase.firestore().collection("cart").doc(usermail)
        await userdoc.delete()
        await userdoc.set({
            item: firebase.firestore.fieldvalue.arrayunion()
        })
        await updatecart()
        await updatestore()


    }

Related Query

More Query from same tag