Skip to content

Commit

Permalink
feat(shopify): add productType to product transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriassuncx committed Feb 11, 2025
1 parent d3b4324 commit fbf19e0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shopify/utils/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const toProduct = (
id: productGroupID,
variants,
vendor,
productType,
} = product;
const {
id: productID,
Expand All @@ -149,6 +150,12 @@ export const toProduct = (
"value": product.descriptionHtml,
};

const productTypeValue: PropertyValue = {
"@type": "PropertyValue",
"name": "productType",
"value": productType,
}

const metafields = (product.metafields ?? [])
.filter((metafield) => metafield && metafield.key && metafield.value)
.map((metafield): PropertyValue => {
Expand All @@ -175,6 +182,7 @@ export const toProduct = (
const additionalProperty: PropertyValue[] = selectedOptions
.map(toPropertyValue)
.concat(descriptionHtml)
.concat(productTypeValue)
.concat(metafields);

const skuImages = nonEmptyArray([image]);
Expand Down

0 comments on commit fbf19e0

Please sign in to comment.