in progress
This commit is contained in:
+33
-6
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user