Add to cart button in collection grid view Dawn 3.0

I am setting up my shop using the Dawn 3.0 theme. I want to add an ‘add to cart’ button in the collection lists. I see instructions for the dawn 2.0 theme, but they do not match up. How is this accomplished with Dawn 3.0?

Thanks!

Chris

hi

use this code

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

{%- if card_product.selected_or_first_available_variant.available -%} {{ 'products.product.add_to_cart' | t }} {%- else -%} {{ 'products.product.sold_out' | t }} {%- endif -%}
{%- endform -%}

Also in theme layout add before header

{% if template == ‘collection’ %}

{% endif %}

I have the same question. Can you tell me where to insert this code??? What file?? Where in the file??

Hi.
In theme code Layout/theme.liquid before add →

{% if template == ‘collection’ %}

{% endif %}

In Snippets/card-product.liquid after

{% render ‘price’, product: card_product, price_class: ‘’ %}

add form

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

{%- if card_product.selected_or_first_available_variant.available -%} {{ 'products.product.add_to_cart' | t }} {%- else -%} {{ 'products.product.sold_out' | t }} {%- endif -%}
{%- endform -%}

I will give this a try. Thank you

Works like a Charm!!