- This topic has 16 replies, 3 voices, and was last updated 3 years, 2 months ago by Ying.
-
AuthorPosts
-
February 14, 2021 at 6:58 am #1657880roadlink
Hello,
I set 300px as image size in customize > woocommerce. https://prnt.sc/zhjln1
It is working very well in shop pages, categories and also Related/Upsell Columns. HereBut I have an issue in main page.
I create columns in main page by woocommerce shortcodes. Like this.
[products limit="4" columns="4" orderby="id" order="DESC"]
But the product images are not exactly 300px and there is gap between them.
https://prnt.sc/zhju0jAny suggestion to fix it?
Can I use category design in main page? like this.
February 14, 2021 at 7:25 am #1657911DavidStaffCustomer SupportHi there,
try this CSS:
.home .woocommerce ul.products li.product { margin-right: 10px; width: calc(25% - 10px); }
Adjust the 10px to suit.
February 14, 2021 at 11:41 am #1658136roadlinkHi David,
Thank you.
Great in desktop.
But mobile become weird. https://prnt.sc/zidnbrFebruary 14, 2021 at 11:55 am #1658143roadlinkthe weird thing is, woocommerce use 300pcs images but resize them to 272px.
I don’t understand why.February 14, 2021 at 2:05 pm #1658241YingStaffCustomer SupportHi Tertas,
We could add a media query to limit the CSS only works for desktop.
@media (min-width: 769px) { .home .woocommerce ul.products li.product{ width: calc(25% - 15px); } .home .woocommerce ul.products li.product:not(.last) { margin-right: 15px; } .woocommerce ul.products { margin-left: 7px; margin-right: -7px; } }
Let me know π
February 14, 2021 at 10:01 pm #1658471roadlinkHello Ying,
Worked well, thanks.
It is weird that it is not working out of the box.
February 15, 2021 at 12:12 pm #1659491YingStaffCustomer SupportNo problem π
February 16, 2021 at 12:41 pm #1660853roadlinkI just realized that this CSS makes right space 25px.
15px from container + 10px from css code.February 16, 2021 at 2:09 pm #1660943YingStaffCustomer SupportDo you need us to help with anything? Let me know π
February 16, 2021 at 2:35 pm #1660968roadlinkHi Ying,
If you have time sure need help πThis code add 10px margin for last product too. “margin-right: 10px;”
Which means last product have total 25px margin to container.
But it should be 15px like left product.February 16, 2021 at 3:00 pm #1660990YingStaffCustomer SupportHaha I’m actually quite busy π
We could modify the selector so that the last product won’t be targeted, edited CSS here:
https://generatepress.com/forums/topic/woocommerce-image-size-created-with-shortcodes/#post-1658241Let me know if it works.
February 17, 2021 at 5:36 am #1661589roadlinkHave a nice day. Sorry to keep you more busy π
Btw, Latest code makes the last product smaller. https://prnt.sc/zuwl1iFebruary 17, 2021 at 8:13 am #1661958DavidStaffCustomer SupportLets keep the margin gap to 15px then you can do this:
@media (min-width: 769px) { .home .woocommerce ul.products li.product{ width: calc(25% - 15px); } .home .woocommerce ul.products li.product:not(.last) { margin-right: 15px; } }
February 17, 2021 at 10:54 am #1662205roadlinkHello David,
Thanks for the code, but result is similar.
https://prnt.sc/zvw465I tried to put arrows regarding the issue.
regards
February 17, 2021 at 11:17 am #1662225YingStaffCustomer SupportHi Tertas,
I edited my pervious CSS here, try this one instead:
https://generatepress.com/forums/topic/woocommerce-image-size-created-with-shortcodes/#post-1658241 -
AuthorPosts
- You must be logged in to reply to this topic.