File tree 2 files changed +9
-27
lines changed 2 files changed +9
-27
lines changed Original file line number Diff line number Diff line change 6
6
</template >
7
7
8
8
<script setup>
9
+ import { useCart } from " @/store/useCart" ;
10
+
11
+ const cart = useCart ();
12
+
13
+ onBeforeMount (() => {
14
+ cart .clearCart ();
15
+ });
16
+
9
17
useHead ({
10
18
title: " Order placed" ,
11
19
titleTemplate: " %s - Nuxt 3 Woocommerce" ,
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ import { defineStore } from "pinia";
2
2
3
3
const state = {
4
4
cart : [ ] ,
5
- order : { } ,
6
- customer : { } ,
7
5
loading : true ,
8
6
error : null ,
9
7
} ;
@@ -26,39 +24,15 @@ export const useCart = defineStore("cartState", {
26
24
removeProductFromCart ( product ) {
27
25
this . cart . splice ( this . cart . indexOf ( product ) , 1 ) ;
28
26
} ,
29
-
30
27
clearCart ( ) {
31
28
this . cart . length = 0 ;
32
29
} ,
33
- clearCustomer ( ) {
34
- this . customer = { } ;
35
- } ,
36
- clearOrder ( ) {
37
- this . order = { } ;
38
- } ,
39
- saveCustomerDetails ( customer ) {
40
- this . customer = customer ;
41
- } ,
42
- saveOrderId ( order ) {
43
- this . order = order ;
44
- } ,
45
- getSingleProduct ( slug ) {
46
- return this . products . find ( ( product ) => product . slug === slug ) ;
47
- } ,
48
30
} ,
49
31
getters : {
50
32
getCartQuantity ( ) {
51
33
return this . cart . reduce ( ( total , product ) => total + product . quantity , 0 ) ;
52
34
} ,
53
- getOrderDetails ( ) {
54
- return this . order ;
55
- } ,
56
- getCartContent ( ) {
57
- return this . cart ;
58
- } ,
59
- getCustomerDetails ( ) {
60
- return this . customer ;
61
- } ,
35
+
62
36
getCartTotal ( ) {
63
37
const currencySymbol = useRuntimeConfig ( ) . public . currencySymbol || "kr" ;
64
38
You can’t perform that action at this time.
0 commit comments