<a href="{{ product.url | within: collection }}"> not working

GM-Mart
Tourist
11 1 3

Hi, 

I'm trying to add an "a" Tag for a whole snippet but it's not working.

 

<div class="main_wrapper">
<a href="{{ product.url | within: collection }}">
<div>
Other Code
<div>
<a>
<div>

 

When I inspect the element it's showing there with the correct URL but it is closing itself and skipping the content inside it.

Like this:  <a href="/collections/mycollection/products/product-name"></a>

I also tried adding it to the product title and image and it's working fine.

Thank You in advance.

 

 

Reply 1 (1)
Jayvin
Shopify Partner
270 40 74

Hi,

You forgot to close the tags, change it like this:

<div class="main_wrapper">
<a href="{{ product.url | within: collection }}">
<div>
Other Code
</div>
</a>
</div>