Hello,
I am trying to use page Metafields to create a list of featured products bespoke for each page. I have managed to get the feature working each page is displaying products based on the products added in the page metafield.
The issue I’m having is that I can’t seem to link an add to cart button to the products. Everything I’ve tried results give me the error: Liquid error: product form must be given a product
Here is my code:
%- if page.metafields.custom.page_curated_products -%}
<div class="section-featured">
<div class="page_padding">
<div class="content_vertical">
<h5 option:text="Featured Products Heading" class="heading_m">Related Items</h5>
<div class="container_4col scrollable">
{% assign related_products = page.metafields.custom.page_curated_products.value %}
{%- for product in related_products -%}
<div>
<div class="frame_container">
<img class="frame_image-wrapper" src="{{ product.featured_image | img_url: 'compact' }}" alt="{{ img.alt }}" loading="lazy">
<a class="frame_image-wrapper" href="{{ product.url}}">
<img loading="lazy" where="src" src="{{ product.images.last | product_img_url: 'master' }}" alt="" class="hover">
</a>
</div>
<div class="frame_leftcontent margin_16">
<a href="{{ product.url }}" class="paragraph_title">{{ product.title }}</a>
<p class="heading_r">{{ product.price | money }}</p>
<a href="{{ product.url }}" class="heading_xs text_colour-red">{{ 't41301a74' | t }}</a>
</div>
</div>
{%- endfor -%}
</div>
</div>
</div>
</div>
{%- endif -%}
Would really appreciate any help I can get on this.
Thanks!