Skip to content

Commit b1d9d5d

Browse files
authored
Merge pull request #1507 from w3bdesign/develop
Fix checkout
2 parents 24c9ea9 + f7ed0dd commit b1d9d5d

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

pages/checkout.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@
77

88
<script setup>
99
import { useCart } from "@/store/useCart";
10+
import { watch } from "vue";
11+
1012
const cart = useCart();
11-
if (cart.cart.length === 0) {
12-
await navigateTo("/");
13-
}
13+
14+
watch(
15+
() => cart.loading,
16+
(loading) => {
17+
if (!loading && cart.cart.length === 0) {
18+
navigateTo("/");
19+
}
20+
},
21+
{ immediate: true },
22+
);
23+
1424
useHead({
1525
title: "Checkout",
1626
titleTemplate: "%s - Nuxt 3 Woocommerce",

pages/product/[product].vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ import GET_SINGLE_PRODUCT_QUERY from "@/apollo/queries/GET_SINGLE_PRODUCT_QUERY.
77
88
const route = useRoute();
99
10-
console.log("Route:", route.query);
11-
1210
const variables = { id: route.query.id };
1311
const { data } = await useAsyncQuery(GET_SINGLE_PRODUCT_QUERY, variables);
1412
15-
console.log("Data:", data);
16-
1713
useHead({
1814
title: route.params.product,
1915
titleTemplate: "%s - Nuxt 3 Woocommerce",

0 commit comments

Comments
 (0)