New Shopify Certification now available: Liquid Storefronts for Theme Developers

How can I add image of grandchild menu?

mitsumasa_anan
Shopify Partner
3 1 0
I'm now trying to capture grandchild's images(featured product image), but the below code doesn't work as the attached image shows.
Kindly let me know the solution.
 
                                   
                                  {% for grandchildlink in childlink.links %}
                                    <li{% if grandchildlink.active %} class="site-nav--active"{% endif %}>
                                      <a
                                        href="{{ grandchildlink.url }}"
                                        class="site-nav__dropdown-link"
                                        data-meganav-type="child"
                                        {% unless request.page_type == 'index' %}{% if grandchildlink.active %}aria-current="page"{% endif %}{% endunless %}
                                        tabindex="-1">
                                          {{ grandchildlink.title | escape }}
                                         
                                          <img src="{{ grandchildlink.featured_image | img_url: 'small' }}">
 
                                        </a>
                                    </li>
                                  {% endfor %}
 
スクリーンショット 2021-04-28 17.35.33.png
Replies 2 (2)
Andre094
Shopify Partner
3 0 0

How did you make it work?

vishal_itgeeks
Visitor
1 0 0

{% for collection in collections %}
{% for product in collection.products limit: 4 %}
{% if grandchildlink.url == product.url %}
{% if product.image %}
<img class="col_img_drawer" src="{{ product.image.src | collection_img_url: '50x50' }}">
{% else %}
<img class="col_img_drawer default" src="{{ product.featured_image | product_img_url: '50x50' }}" alt={{ product.price }} >
{% endif %}
{% endif %}
{%endfor%}
{% endfor %}