Add Static image to product grid in collection (Be Yours Theme)

Add Static image to product grid in collection (Be Yours Theme)

talonwr
Shopify Partner
7 0 2

I want to add static images at regular intervals within the product grid part of my collection pages. 

 

I want each static image to appear as 2 products wide and to show after every other row alternating sides like so

productproduct[ImageHere]
productproductproductproduct
[ImageHere]productproduct
productproductproductproduct
productproduct[ImageHere]


I want to do this on the "Be Yours" theme. I want the [image here]'s to be pulled from a collection metafield I already made titled "In-Grid Images".

Anyone know how I would go about doing that?

Replies 2 (2)

Guleria
Shopify Partner
3403 679 963

Try this

{% for product in collection.products %}
  <!-- Render product details here -->
  // Exisitng code // call for product loop
  {% if forloop.index == 3 %}
    <!-- Insert static image after every 3rd product -->
    <img src="path_to_static_image_1.jpg" alt="Static Image 1">
  {% elsif forloop.index == 6 %}
    <!-- Insert static image after every 6th product -->
    <img src="path_to_static_image_2.jpg" alt="Static Image 2">
  {% endif %}
{% endfor %}

 

Noe: You need to adjust the html a/to your need in the code.

 

Thanks

 

 

- If helpful then please Like and Accept Solution.
- Drop an email   if you are looking for quick fix or any customization
- Email: [email protected]
- Try GEMPAGES a great page builder

johndepict
Shopify Partner
7 0 0

we built a no-code collection page/grid builder so that you don't have to solve this with custom code: https://apps.shopify.com/depict

works natively with most shopify themes (should work with "be yours")

just ping me if you have any questions!