in progress

This commit is contained in:
Thomas
2020-02-24 17:25:57 +01:00
parent 2143b99606
commit 5ea6dcfaa1
10 changed files with 121 additions and 65 deletions
+15 -5
View File
@@ -1,10 +1,20 @@
export default {
methods: {
addToCart (product) {
this.$store.commit('addToCart', product)
this.$buefy.toast.open({
message: 'Product added',
type: 'is-success'
addToCart (product, checkout) {
// add to cart
this.$store.dispatch('addItemToCart', product).then((item) => {
// eslint-disable-next-line no-console
console.log('item : ', item)
const lineItemsToAdd = {
variantId: item.variants[0].id,
quantity: item.count
}
// Add an item to the checkout
this.$shopify.checkout.addLineItems(checkout.id, lineItemsToAdd)
this.$buefy.toast.open({
message: 'Product added',
type: 'is-success'
})
})
}
}