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