link dynamic content to a collection

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe
2024-07-08 08:52:10 +07:00
parent ebbc8f053c
commit d8e7553918
6 changed files with 25 additions and 23 deletions

View File

@@ -358,6 +358,7 @@ const reshapeCollection = (collection: ShopifyCollection): Collection | undefine
...collection,
helpfulLinks: parseMetaFieldValue<string[]>(collection.helpfulLinks),
helpfulLinksTop: parseMetaFieldValue<string[]>(collection.helpfulLinksTop),
dynamicContent: collection.dynamicContent?.value || null,
path: getCollectionUrl(collection.handle)
};
};

View File

@@ -15,6 +15,9 @@ const collectionFragment = /* GraphQL */ `
helpfulLinksTop: metafield(namespace: "custom", key: "helpful_links_top") {
value
}
dynamicContent: metafield(namespace: "custom", key: "plp_content") {
value
}
updatedAt
}
${seoFragment}

View File

@@ -42,10 +42,14 @@ export type CartItem = {
addOnProduct?: CartItem & { quantity: number };
};
export type Collection = Omit<ShopifyCollection, 'helpfulLinks' | 'helpfulLinksTop'> & {
export type Collection = Omit<
ShopifyCollection,
'helpfulLinks' | 'helpfulLinksTop' | 'dynamicContent'
> & {
path: string;
helpfulLinks: string[] | null;
helpfulLinksTop: string[] | null;
dynamicContent: string | null;
};
export type Customer = {
@@ -513,6 +517,7 @@ export type ShopifyCollection = {
updatedAt: string;
helpfulLinks: { value: string } | null;
helpfulLinksTop: { value: string } | null;
dynamicContent: { value: string } | null;
};
export type ShopifyProduct = {