mirror of
https://github.com/vercel/commerce.git
synced 2025-05-20 00:16:59 +00:00
variants
This commit is contained in:
parent
e513d3b490
commit
5027363c3e
@ -1,7 +1,7 @@
|
|||||||
COMPANY_NAME="Vercel Inc."
|
COMPANY_NAME=" "
|
||||||
TWITTER_CREATOR="@vercel"
|
TWITTER_CREATOR=" "
|
||||||
TWITTER_SITE="https://nextjs.org/commerce"
|
TWITTER_SITE="https://nextjs.org/commerce"
|
||||||
SITE_NAME="Next.js Commerce"
|
SITE_NAME="WKND Commerce"
|
||||||
SHOPIFY_REVALIDATION_SECRET=
|
SHOPIFY_REVALIDATION_SECRET=
|
||||||
SHOPIFY_STOREFRONT_ACCESS_TOKEN=
|
SHOPIFY_STOREFRONT_ACCESS_TOKEN=
|
||||||
SHOPIFY_STORE_DOMAIN=
|
SHOPIFY_STORE_DOMAIN=
|
||||||
|
@ -544,12 +544,63 @@ export function transformToProduct(adventure: any): Product {
|
|||||||
{ name: 'activity', value: adventure.activity },
|
{ name: 'activity', value: adventure.activity },
|
||||||
{ name: 'adventureType', value: adventure.adventureType },
|
{ name: 'adventureType', value: adventure.adventureType },
|
||||||
{ name: 'tripLength', value: adventure.tripLength },
|
{ name: 'tripLength', value: adventure.tripLength },
|
||||||
{ name: 'groupSize', value: adventure.groupSize },
|
{ name: 'Group Size', value: 'Normal' }
|
||||||
{ name: 'difficulty', value: adventure.difficulty }
|
// { name: 'difficulty', value: adventure.difficulty }
|
||||||
],
|
],
|
||||||
price
|
price
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const smallGroupVariant = {
|
||||||
|
id: 'smallGroupVariant',
|
||||||
|
title: 'Small Group',
|
||||||
|
availableForSale: true,
|
||||||
|
selectedOptions: [
|
||||||
|
{
|
||||||
|
name: 'Group Size',
|
||||||
|
value: 'Small'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
price: price
|
||||||
|
};
|
||||||
|
|
||||||
|
const normalGroupVariant = {
|
||||||
|
id: 'normalGroupVariant',
|
||||||
|
title: 'Normal Group',
|
||||||
|
availableForSale: true,
|
||||||
|
selectedOptions: [
|
||||||
|
{
|
||||||
|
name: 'Group Size',
|
||||||
|
value: 'Normal'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
price: price
|
||||||
|
};
|
||||||
|
|
||||||
|
const largeGroupVariant = {
|
||||||
|
id: 'largeGroupVariant',
|
||||||
|
title: 'Large Group',
|
||||||
|
availableForSale: true,
|
||||||
|
selectedOptions: [
|
||||||
|
{
|
||||||
|
name: 'Group Size',
|
||||||
|
value: 'Large'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
price: price
|
||||||
|
};
|
||||||
|
|
||||||
|
const groupSizeProductOption = {
|
||||||
|
id: 'groupSizeProductOption',
|
||||||
|
name: 'Group Size',
|
||||||
|
values: ['Small', 'Normal', 'Large']
|
||||||
|
};
|
||||||
|
|
||||||
|
const durationProductOption = {
|
||||||
|
id: 'durationProductOption',
|
||||||
|
name: 'Stay Duration',
|
||||||
|
values: ['Short', 'Normal', 'Extended Stay']
|
||||||
|
};
|
||||||
|
|
||||||
const product: Product = {
|
const product: Product = {
|
||||||
id,
|
id,
|
||||||
handle,
|
handle,
|
||||||
@ -557,7 +608,7 @@ export function transformToProduct(adventure: any): Product {
|
|||||||
title: adventure.title,
|
title: adventure.title,
|
||||||
description: adventure.description.html,
|
description: adventure.description.html,
|
||||||
descriptionHtml: adventure.itinerary.html,
|
descriptionHtml: adventure.itinerary.html,
|
||||||
options: [], // No clear mapping for options from the given input
|
options: [groupSizeProductOption],
|
||||||
priceRange: {
|
priceRange: {
|
||||||
maxVariantPrice: price,
|
maxVariantPrice: price,
|
||||||
minVariantPrice: price
|
minVariantPrice: price
|
||||||
@ -575,7 +626,8 @@ export function transformToProduct(adventure: any): Product {
|
|||||||
description: adventure.description.html
|
description: adventure.description.html
|
||||||
},
|
},
|
||||||
tags: [],
|
tags: [],
|
||||||
variants: [],
|
//variants: { edges: [{ node: mockProductVariant }] },
|
||||||
|
variants: [smallGroupVariant, normalGroupVariant, largeGroupVariant],
|
||||||
updatedAt: new Date().toISOString()
|
updatedAt: new Date().toISOString()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user