Browse Source

feat module 6, 7 : pull note data from shopify, include note identifiers in product service

master
nadia 2 days ago
parent
commit
d4b403828f
2 changed files with 36 additions and 0 deletions
  1. 35
    0
      src/components/ProductDetails/ProductDetails.jsx
  2. 1
    0
      src/services/ProductService.js

+ 35
- 0
src/components/ProductDetails/ProductDetails.jsx View File

400
   const careInstructionMetafield = product?.metafields?.care_instruction
400
   const careInstructionMetafield = product?.metafields?.care_instruction
401
   const shippingInformationMetafield = product?.metafields?.shipping_information
401
   const shippingInformationMetafield = product?.metafields?.shipping_information
402
   const returnExchangeMetafield = product?.metafields?.return_exchange
402
   const returnExchangeMetafield = product?.metafields?.return_exchange
403
+  const noteMetafield = product?.metafields?.note
403
   const productDetailsMetafield = product?.metafields?.product_details
404
   const productDetailsMetafield = product?.metafields?.product_details
404
   const sizeChartMetafield = product?.metafields?.size_chart
405
   const sizeChartMetafield = product?.metafields?.size_chart
405
   const sizeChartImageUrl = sizeChartMetafield?.reference?.image?.url || sizeChartMetafield?.reference?.url || ""
406
   const sizeChartImageUrl = sizeChartMetafield?.reference?.image?.url || sizeChartMetafield?.reference?.url || ""
470
     </Box>
471
     </Box>
471
   )
472
   )
472
 
473
 
474
+  // Renders Shopify product metafield custom.note inside the Note row.
475
+  const notePanel = noteMetafield?.value ? (
476
+    <Box sx={infoPanelSx}>
477
+      <Collapse in={Boolean(expandedInfoRows.note)} timeout="auto">
478
+        <Box
479
+          sx={{
480
+            ...infoPanelContentSx,
481
+            minHeight: noteMetafield.value ? 0 : 28,
482
+          }}
483
+        >
484
+          {renderShopifyRichText(noteMetafield.value)}
485
+        </Box>
486
+      </Collapse>
487
+    </Box>
488
+  ) : null
489
+
473
   // Renders Shopify product metafield custom.product_details inside the Product Details row.
490
   // Renders Shopify product metafield custom.product_details inside the Product Details row.
474
   const productDetailsPanel = (
491
   const productDetailsPanel = (
475
     <Box sx={infoPanelSx}>
492
     <Box sx={infoPanelSx}>
936
             {expandedInfoRows.returnExchanges ? <RemoveIcon sx={{ fontSize: 18 }} /> : <AddIcon sx={{ fontSize: 18 }} />}
953
             {expandedInfoRows.returnExchanges ? <RemoveIcon sx={{ fontSize: 18 }} /> : <AddIcon sx={{ fontSize: 18 }} />}
937
           </Box>
954
           </Box>
938
           {returnExchangesPanel}
955
           {returnExchangesPanel}
956
+
957
+          {/* Note */}
958
+          {noteMetafield?.value && (
959
+            <Box
960
+              onClick={() => toggleInfoRow("note")}
961
+              sx={{
962
+                ...infoRowSx(expandedInfoRows.note),
963
+                pb: 2,
964
+                borderBottom: "none"
965
+              }}
966
+            >
967
+              <Typography variant="body2" sx={{ textTransform: "uppercase", fontWeight: "400", fontSize: { xs: "0.875rem", md: "1.1rem" } }}>
968
+                Note
969
+              </Typography>
970
+              {expandedInfoRows.note ? <RemoveIcon sx={{ fontSize: 18 }} /> : <AddIcon sx={{ fontSize: 18 }} />}
971
+            </Box>
972
+          )}
973
+          {notePanel}
939
         </Box>
974
         </Box>
940
       </Box>
975
       </Box>
941
 
976
 

+ 1
- 0
src/services/ProductService.js View File

185
           {key: "care_instruction", namespace: "custom"},
185
           {key: "care_instruction", namespace: "custom"},
186
           {key: "shipping_information", namespace: "custom"},
186
           {key: "shipping_information", namespace: "custom"},
187
           {key: "return_exchange", namespace: "custom"},
187
           {key: "return_exchange", namespace: "custom"},
188
+          {key: "note", namespace: "custom"},
188
           {key: "product_details", namespace: "custom"},
189
           {key: "product_details", namespace: "custom"},
189
           {key: "size_chart", namespace: "custom"}
190
           {key: "size_chart", namespace: "custom"}
190
         ]
191
         ]

Loading…
Cancel
Save