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
+33 -6
View File
@@ -1,14 +1,41 @@
<template>
<el-row>
<el-col>
<h1>Panier</h1>
</el-col>
</el-row>
<div>
<h1>Panier</h1>
<b-button
type="is-primary"
@click="confirmCheckout"
>
Checkout
</b-button>
</div>
</template>
<script>
export default {
name: 'Index'
name: 'Index',
computed: {
checkout () {
return this.$store.state.checkout
}
},
methods: {
confirmCheckout () {
this.$shopify.checkout.create().then((checkout) => {
// eslint-disable-next-line no-console
console.log(checkout)
this.$store.state.cart.forEach((item) => {
const lineItemsToAdd = {
variantId: item.variants[0].id,
quantity: item.count
}
// Add an item to the checkout
this.$shopify.checkout.addLineItems(checkout.id, lineItemsToAdd).then((checkout) => {
})
})
})
}
}
}
</script>