add product to checkout when added to cart
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<b-button
|
||||
icon-left="cart"
|
||||
class="mx-2"
|
||||
@click="addToCart(product)"
|
||||
@click="addToCart(product, checkout)"
|
||||
>
|
||||
Ajouter
|
||||
</b-button>
|
||||
@@ -20,14 +20,14 @@ export default {
|
||||
mixins: [
|
||||
cartMixins
|
||||
],
|
||||
async asyncData ({ params, $shopify }) {
|
||||
const product = await $shopify.product.fetchByHandle(params.handle)
|
||||
return { product }
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
product: {}
|
||||
}
|
||||
},
|
||||
async asyncData ({ params, $shopify }) {
|
||||
const product = await $shopify.product.fetchByHandle(params.handle)
|
||||
return { product }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<b-button
|
||||
type="is-primary"
|
||||
icon-left="cart"
|
||||
@click="addToCart(product)"
|
||||
@click="addToCart(product, checkout)"
|
||||
>
|
||||
Buy
|
||||
</b-button>
|
||||
@@ -49,16 +49,14 @@ export default {
|
||||
mixins: [
|
||||
cartMixins
|
||||
],
|
||||
async asyncData ({ $shopify, store }) {
|
||||
const products = await $shopify.product.fetchAll()
|
||||
store.commit('setProducts', products)
|
||||
},
|
||||
computed: {
|
||||
products () {
|
||||
return this.$store.state.products
|
||||
}
|
||||
},
|
||||
async asyncData ({ $shopify, store }) {
|
||||
const products = await $shopify.product.fetchAll()
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(products)
|
||||
store.commit('setProducts', products)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user