Adding an "Add to cart button to Collection Pages" in Dawn theme

Hi, I’m trying to add “Add to cart” button to a “Featured Collection” Section on the Home Page. Currently got “Dawn” theme installed.

I’m doing it in 2 ways, both of which don’t work for me.

  1. I’m adding this code to the product-card.liquid:

(copied it from main-product.liquid)

{%- form ‘product’, product, id: product_form_id, class: ‘form’, novalidate: ‘novalidate’, data-type: ‘add-to-cart-form’ -%}

{%- if product.selected_or_first_available_variant.available -%} {{ 'products.product.add_to_cart' | t }} {%- else -%} {{ 'products.product.sold_out' | t }} {%- endif -%}
{%- if block.settings.show_dynamic_checkout -%} {{ form | payment_button }} {%- endif -%}
{%- endform -%}

This makes error text appear under the products instead of a button:

“Liquid error (product-card line 82): product form must be given a product”

  1. Another code I’m dding to the product-card.liquid:

(copied it from one of the other themes we have)

This adds the button to the products, but when clicked, it brings up an error page with this message:

"Something went wrong. Parameter Missing or Invalid: Required parameter missing or invalid: id "

Not sure what am I doing wrong.

Is there a way to add an “Add to cart” button to the products on the Collection Page, that would work?

We don’t have variants or colours on products, every product is just a single variant, no need to account for that.

Thank you for your help.

Email me so,
I can solve it.
Thank You.

Found a solution to my problem here:

https://community.shopify.com/post/1334844

Hey @OSt , watch this YouTube video to easily implement an “Add to Cart” button on your Shopify collection pages: https://www.youtube.com/watch?v=s98l1bUZe6k