How to display product variants without liquid error in Dawn Theme?

I’m currently using Dawn Theme. Below I’ve linked some of my code:

This is added to my main-collection-product-grid.liquid.

              {% for product in collection.products %}
                {% assign variant_colors = '' %}
                {% for variant in product.variants %}
                  {% if variant.available %}
                    {% capture variant_color %}{{ variant.option1 }}{% endcapture %}
                    {% unless variant_colors contains variant_color %}
                      {% assign variant_colors = variant_colors | append: variant_color | append: ',' %}
                      <li class="grid__item">
                        {% render 'card-product',
                          card_product: variant,
                          media_aspect_ratio: section.settings.image_ratio,
                          show_secondary_image: section.settings.show_secondary_image,
                          show_vendor: section.settings.show_vendor,
                          show_rating: section.settings.show_rating,
                          lazy_load: lazy_load,
                          show_quick_add: section.settings.enable_quick_add,
                          section_id: section.id
                        %}
                      </li>
                    {% endunless %}
                  {% endif %}
                {% endfor %}
              {% endfor %}

It functions to display product variants, however, when doing so I get a liquid error on all variants because:

Liquid error (snippets/card-product line 268): product form must be given a product

Here is a github gist link to my card-product file.

card-product.liquid (github.com)

My question is how do I go about making it function to display variants without causing the liquid error? I would also like it to display the variants with the product title not variant title, but I can probably figure this out myself.

Hi @vvr ,

Can you share your store url

A-Tier Apparel (atierapparel.com)

It is because of the quick-add button. I do not know how to make the quick-add button function with the variants.