diff --git a/templates/components/products/tabs.html b/templates/components/products/tabs.html index 900b5d23ae..c9444ea672 100644 --- a/templates/components/products/tabs.html +++ b/templates/components/products/tabs.html @@ -1,26 +1,72 @@ +{{assignVar "hasSizeGuide" 0}} +{{#each metafields.edges }} + {{#if node.key "===" "size-guide"}} + {{assignVar "hasSizeGuide" 1}} + {{/if}} +{{/each}} + +{{#filter metafields.edges "size-guide" property="node.key"}} + {{assignVar "hasSizeGuide" 1}} +{{/filter}} +
-{{#if product.related_products}} - -{{/if}} + {{#if product.related_products}} + + {{/if}} -{{#if product.similar_by_views}} -
- {{> components/products/carousel products=product.similar_by_views columns=6 list="Customers Also Viewed"}} -
-{{/if}} + {{#if product.similar_by_views}} +
+ {{> components/products/carousel products=product.similar_by_views columns=6 list="Customers Also Viewed"}} +
+ {{/if}} + + + {{#if (getVar "hasSizeGuide") "===" 1}} +
+ + {{#filter metafields.edges "size-guide" property="node.key"}} + {{#JSONparse node.value}} + {{#withFirst this}} +

{{heading}}

+
+ {{{details}}} +
+ {{/withFirst}} + {{/JSONparse }} + {{/filter}} + +
+ {{/if}}
diff --git a/templates/pages/product.html b/templates/pages/product.html index 24fa556748..aae69ff833 100644 --- a/templates/pages/product.html +++ b/templates/pages/product.html @@ -8,6 +8,22 @@ limit: {{theme_settings.productpage_related_products_count}} similar_by_views: limit: {{theme_settings.productpage_similar_by_views_count}} +gql: "query productById($productId: Int!) { + site { + product(entityId: $productId) { + metafields(namespace: \"shared\", keys: [\"size-guide\"]) { + edges { + node { + id + key + value + } + } + } + } + } +} +" --- {{inject 'productId' product.id}} @@ -19,11 +35,15 @@ {{> components/common/alert/alert-info message}} {{/each}} + +
{{> components/products/product-view}} {{{region name="product_below_content"}}} + + {{#if product.videos.list.length}} {{> components/products/videos product.videos}} {{/if}} @@ -32,7 +52,19 @@ {{> components/products/reviews reviews=product.reviews product=product urls=urls}} {{/all}} - {{> components/products/tabs}} + {{> components/products/tabs metafields=gql.data.site.product.metafields.edges }} + + {{#each gql.data.site.product.metafields.edges }} + {{#if node.key '===' 'size-guide'}} + {{#JSONparse node.value}} + {{#withFirst .}} +

{{heading}}

+ {{{details}}} + {{/withFirst}} + {{/JSONparse}} + {{/if}} + {{/each}} +
{{> components/products/schema}}