I'm creating a e-commerce with Vue & Firebase. Trying to add some cart information from the current logged in user. Strange thing is at the very first time information saved perfectly. When I trying to add some again. That dosent work and show this error.
Uncaught FirebaseError: Function DocumentReference.set() called with invalid data. Unsupported field value: undefined
So I have to refresh that page. Then it work again. I cant understand where is the problem.
Note: If I try to add any other value instead of cart. then it works fine.
checkoutLoggedInUser(){
var db = firebase.firestore();
var user = firebase.auth().currentUser;
db.collection("orders").add({
user_id:user.uid,
cart:this.$store.getters.cart
})
this.$store.commit('emptyCart')
this.$router.push({ name: 'Home'})
}