How to target the right Path in my table collection I kinda built

Topic summary

A user is building a product table using Metafields that displays collection items with custom data (rod specifications). The table currently adds products to cart but defaults to the first variant instead of opening the product page.

Initial Problem:

  • Table uses metafields to show product details (model, pieces, length, line rating, price)
  • “Buy” button adds default variant to cart rather than linking to product page
  • User needs products with many variants to open for selection instead

Solution Provided:

  • Replace cart functionality with anchor tag linking to /products/{{product.handle}}
  • Use double curly braces {{ }} for Liquid variable output
  • The handle is a built-in Shopify product property, not a custom metafield

Resolution:
Issue resolved after correcting syntax to {{product.handle}}. User confirmed the link now works properly. A reference to Shopify’s Liquid documentation basics was shared for further learning.

Summarized with AI on November 11. AI used: claude-sonnet-4-5-20250929.

I’ve been using Metafields to create a table that pulls the info for different products in a collections. Right now this is setup to add that product to the cart. But gives you the Default product im assuming on the top of the array of products(or Objects… not sure what the right term is ha.)

Code for the table i frankensteined… you will see in the note on the code where I need help.. I think.


  {% for product in collection.products %}
  
  {% endfor %}

| Model | Rod Pieces | Rod Length | Line Rating | Price | Buy |
| - | - | - | - | - | - |
| {{ product.metafields.custom.rod_series }} | {{ product.metafields.custom.rod_piece }} | {{ product.metafields.custom.rod_length }} | {{ product.metafields.custom.line_weight }} | {{ product.price | money_with_currency }} | <br>      {% if product.variants.size > 0 %}<br>        <br>        <br>      {% endif %}<br>     |

What is the path to just open the product. So instead of it adding to your cart it takes you to the product? These products have so many variants that I don’t know how to add code to where you could select varients and add to the cart.. Still very new to coding. That would be the end goal but for now a way to target the product vs adding to the cart.

Any help is welcomed..

Hey @DavidBeuy !

You’ll want to use an anchor tag (a link) and point it to /products/{product.handle}

So something like this:

{% for product in collection.products %}
  
    {{ product.metafields.custom.rod_series }}
    {{ product.metafields.custom.rod_piece }}
    {{ product.metafields.custom.rod_length }}
    {{ product.metafields.custom.line_weight }}
    {{ product.price | money_with_currency }}
    
      {% if product.variants.size > 0 %}
        View product
      {% endif %}
    
  
{% endfor %}

Let me know if you get stuck :slightly_smiling_face:

Some of the Documentation is hard to understand for this ha

So I think I see where this goes. I subbed out the code and it opens a link to a page that says not found. Do i need to add a “handle” metafield and give a handle to each of my products? Or is “handle” a built in term that it know what to do?

Again.. still pretty new to coding so it all a learning process for me. Thanks for the Reply and the help I really do appreciate it!

ahhhh It did work i just had to add the extra { } so “/products/{{product.handle}}”

Now maybe a shot in the dark, but when passing info do you always have to double the {{ Curly Brackets }}?

Sorry for the bumsteer, @DavidBeuy , there was a typo in my code - you’re correct, it should be double curly braces. {{ handle }}.

Some handy liquid docs: https://shopify.github.io/liquid/basics/introduction/