Jump to content

Limit the number of related products

Go to solution Solved by tuanphan,

Recommended Posts

13 minutes ago, Arch said:

@tuanphan

Hello! Would you be able to tell me how to reduce the size of the images on my related products section? I think best way is to make it so that there are more columns like 5 columns maybe or reduce the height of the section. Please can you help? site: http://www.arch-worldwide.com/shop-all

Add to Home > Design > Custom CSS

@media screen and (min-width:768px) {
section.ProductItem-relatedProducts .list-grid {
    display: grid !important;
    grid-template-columns: repeat(5,minmax(0,1fr)) !important;
}
}

 

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
7 minutes ago, tuanphan said:

Add to Home > Design > Custom CSS


@media screen and (min-width:768px) {
section.ProductItem-relatedProducts .list-grid {
    display: grid !important;
    grid-template-columns: repeat(5,minmax(0,1fr)) !important;
}
}

 

Somehow this doesn't work for me... but I managed to do it with this!

.ProductItem-relatedProducts .list-grid 
{grid-template-columns: 200px 200px 200px 200px !important;
}

Link to comment
  • 4 months later...

//* You Might Also Like...2 instead of 5 *//
.ProductItem-relatedProducts .list-grid .grid-item:nth-child(n+3) {
    display: none;
}
@media screen and (max-width:767px) {
.ProductItem-relatedProducts .list-grid .grid-item:nth-child(n+3) {
    display: none;
}
}

This works wonderfully!!!!! 2 suggested products look so much better than 5. Thank you 🙂

Screen Shot 2020-11-01 at 10.02.24 AM.png

Screen Shot 2020-11-01 at 10.01.55 AM.png

Link to comment
  • 1 month later...
  • 7 months later...

Aha! This is an old thread but I ran into this problem today and solved it to my satisfaction by combining two of the CSS bits provided, so that I get only 3 related items suggested AND they are not overly large. Thus: 

 

.ProductItem-relatedProducts .list-grid .grid-item:nth-child(n+4) {
    display: none;
}
.ProductItem-relatedProducts .list-grid 
{grid-template-columns: 200px 200px 200px 200px !important;
}

Hope this helps someone! I know I will be making a note of this for future use. ^.^

circle-member-badge-outline.jpg.1bd7516b048604fda734aa880717e704.jpg

Link to comment
  • 2 years later...
On 1/18/2024 at 10:10 AM, NadineS said:

Same question ish.

On Desktop:

How to get 5 items across with smaller images?

Mobile:

4 recommended items on mobile but have them 2 across and 2 down? In a grid?

https://www.hausersjewelers.com/shop/p/square-hoop-earrings

Desktop: Can you add more items? Currently I see 4 items only

Mobile: Use this CSS code

@media screen and (max-width:767px) {
.products.collection-content-wrapper div.ProductItem-relatedProducts .list-grid {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    grid-gap: 5px !important;
}

.products.collection-content-wrapper div.ProductItem-relatedProducts .list-grid .grid-item {
    width: 100% !important;
}}

image.png.9a41b2369c52e84a12fd363ceb23b2be.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

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.