Jump to content

[Share] How to add Icons under Product Block

Recommended Posts

To add Icons under Product title in Product Block, you can follow these.

#1. Suppose you have 3 product blocks, you need to add icons to this position

image.png.2bb78a57ef3978684f9ea3ef08f3c685.png

#2. Add a Code Block under with this code

<div class="product-icon1">
  <div class="product-icon-img">
<img src="https://images.squarespace-cdn.com/content/6672ecf757a5d945cabc3965/1726717042892-IZQI98AO6BPMRGT0TAVN/icon1.png?content-type=image%2Fpng"/>
<img src="https://images.squarespace-cdn.com/content/6672ecf757a5d945cabc3965/1726717044715-RQ7EFNC3L4OG5W8UWPZP/icon2.png?content-type=image%2Fpng"/>
  </div>
  <div class="product-icon-text">
  </div>
</div>
<div class="product-icon2">
  <div class="product-icon-img">
<img src="https://images.squarespace-cdn.com/content/6672ecf757a5d945cabc3965/1726717042892-IZQI98AO6BPMRGT0TAVN/icon1.png?content-type=image%2Fpng"/>
<img src="https://images.squarespace-cdn.com/content/6672ecf757a5d945cabc3965/1726717044715-RQ7EFNC3L4OG5W8UWPZP/icon2.png?content-type=image%2Fpng"/>
  </div>
  <div class="product-icon-text">
  </div>
</div>
<div class="product-icon3">
  <div class="product-icon-img">
<img src="https://images.squarespace-cdn.com/content/6672ecf757a5d945cabc3965/1726717044715-RQ7EFNC3L4OG5W8UWPZP/icon2.png?content-type=image%2Fpng"/>
<img src="https://images.squarespace-cdn.com/content/6672ecf757a5d945cabc3965/1726717043632-DHRX88GKXSQ34N02GJI6/icon3.png?content-type=image%2Fpng"/>
  </div>
  <div class="product-icon-text">
  </div>
</div>
<style>
.product-icon-img {
  display: flex;
  flex-wrap: nowrap;
}
  [class*="product-icon"] img {
    width: calc(50% - 20px);
    margin-left: 5px;
    margin-right: 5px;
  }
</style>

image.png.82539fc1adc5eb997fde31129b854f47.png

You can replace icon example url with your icon url.

#3. Find ID of 3 Product Blocks.

In my example, we will have

  • #block-yui_3_17_2_1_1726795121076_7491
  • #block-b411250f9352c58b7b3b
  • #block-5d441f6c28e67949327a

image.png.3fb19f9ef3738031eefb7a6103eeb9f8.png

#4. Use this code to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $('.product-icon1').appendTo('#block-yui_3_17_2_1_1726795121076_7491 .productDetails');
    $('.product-icon2').appendTo('#block-b411250f9352c58b7b3b .productDetails');
    $('.product-icon3').appendTo('#block-5d441f6c28e67949327a .productDetails');
});
</script>

image.png.3d18daba3bc6ef0c34a008ee2c239864.png

#5. Result

image.png.7decb4a79bb63303d5a70f867c23fdc7.png

#6. To adjust Icon size, you can adjust this line in Code Block

image.png.0b4f0f17be681031b03ed54e81749504.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Replies 0
  • Views 496
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.