File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ const SingleProduct = ({ product }) => {
14
14
setIsLoading ( false ) ;
15
15
} , [ ] ) ;
16
16
17
- console . log ( "Product information: " ) ;
18
- console . log ( product ) ;
17
+ // console.log("Product information: ");
18
+ // console.log(product);
19
19
20
20
const {
21
21
description,
@@ -72,6 +72,27 @@ const SingleProduct = ({ product }) => {
72
72
< p className = "pt-1 mt-4 text-2xl text-gray-900" >
73
73
{ DESCRIPTION_WITHOUT_HTML }
74
74
</ p >
75
+
76
+ { product . variations && (
77
+ < p className = "pt-1 mt-4 text-xl text-gray-900" >
78
+ < span className = "py-2" > Varianter</ span >
79
+ < select
80
+ id = "farge"
81
+ className = "block w-64 px-6 py-2 bg-white border border-gray-500 rounded-lg focus:outline-none focus:shadow-outline"
82
+ >
83
+ { product . variations . nodes . map ( ( { id, name } ) => {
84
+ const filteredName = name . split ( '-' ) . pop ( ) ;
85
+
86
+ return (
87
+ < option key = { id } value = { filteredName } >
88
+ { filteredName }
89
+ </ option >
90
+ ) ;
91
+ } ) }
92
+ </ select >
93
+ </ p >
94
+ ) }
95
+
75
96
{ /*
76
97
<p className="pt-1 mt-4 text-xl text-gray-900">
77
98
<span className="py-2">Farge</span>
Original file line number Diff line number Diff line change @@ -37,9 +37,12 @@ export const GET_SINGLE_PRODUCT = gql`
37
37
nodes {
38
38
id
39
39
name
40
- stockStatus
41
- price
40
+ stockStatus
42
41
stockQuantity
42
+ purchasable
43
+ onSale
44
+ salePrice
45
+ regularPrice
43
46
}
44
47
}
45
48
}
You can’t perform that action at this time.
0 commit comments