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.
- 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’ -%}
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”
- 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.