Number and size of related products

I used the CSS code from this thread, it works but skips a couple columns in between which is really weird.

Any solutions?

image

Comments

  • What shortcode you mean?
  • This css
    .woocommerce .related ul.products li.product, .woocommerce .related ul li.product, .woocommerce .upsells.products ul.products li.product, .woocommerce .upsells.products ul li.product, .woocommerce-page .related ul.products li.product, .woocommerce-page .related ul li.product, .woocommerce-page .upsells.products ul.products li.product, .woocommerce-page .upsells.products ul li.product { width: 23% !important; }
    .woocommerce ul.products:not(.col-4) li.product:nth-child(3n+1) { clear: none !important; }
  • Ok, but what is the link of page where you used it and where you got above products?
  • Hey guys, I just faced the same problem as described here. But instead of 4 products in the upsells-section I've tried to get 5 products in that section.

    Result was that five products were shown in upsells-section but grid-view in "Shop" and "Category" was broken - example for that.

    My CSS basing on your above code is:

    .woocommerce .related ul.products li.product, .woocommerce .related ul li.product, .woocommerce .upsells.products ul.products li.product, .woocommerce .upsells.products ul li.product, .woocommerce-page .related ul.products li.product, .woocommerce-page .related ul li.product, .woocommerce-page .upsells.products ul.products li.product, .woocommerce-page .upsells.products ul li.product { width: 18% !important; }
    .woocommerce ul.products:not(.col-5) li.product:nth-child(3n+1) { clear: none !important; }


    Can you have a look at that problem!?
    thx!
  • @paderdeko We are sorry but it is not possible to do it anymore. The only place where you can set number of related products is Theme options > Blog, Portfolio & Shop > Shop section.
  • ok but "related products" in theme options > blog,portfolio & shop > shop is not the same option as "upsells" in single product options.

    It seems you have changed core so above code is no more valid. Can you provide an alternative how to show 4 or 5 UPSELLS and not related products?
  • @paderdeko No, we didn't changed anything. Only WooCommerce changes their stuff constantly and everything is dependent on plugin's author only. Like we wrote above, what you ask for requires files customization now and is not possible with custom css.
  • Hey, I've talked to Woocommerce author and they provided a php-snippet.


    But as a result of this code, that happens: EXAMPLE

    Next discussion with WC-author Mike Jolley showed up that this malfunction is due to theme code.

    So don't feel offended now but it seems that our beTheme is the reason why more than 3 products in a row in upsells section won't work. Can you check this once more please and have a look at that penomenon?
    And if it takes more than you thought, could you at least put that feature on your roadmap as it is asked by several customers here in the forum.

    Thx and greetz!
  • Here is the conversation with one of the woocommerce-authors:


    Might be a hint to a suitable solution for us all..
  • @paderdeko If you send us access to your dashboard and FTP privately, we may switch to default WP theme and check. And if it would work the same on default theme as with the BeTheme, there would be nothing what we can do because each plugin need to work the same way with BeTheme as with any default theme.
  • I've also checked that option and with theme twentysixteen the problem doesn't occure in the above documented way. Products are all lined-up correct but only 4 products show up - instead of my 5.

    You'll get an account for dashboard and FTP like asked. I'll send it via themeforrest.
  • @muffingroup

    Do you guys want me to share your result in form of the CSS? Or do you integrate your solution in a future update..?!
  • @paderdeko, please share the solution here for anyone in future can use it too.
  • body.woocommerce .related ul.products li.product, .woocommerce .upsells.products ul.products li.product { width: 18% !important;}
    body.woocommerce .related ul.products li.product:nth-child(2n+1), .woocommerce .upsells.products ul.products li.product:nth-child(2n+1),
    body.woocommerce .related ul.products li.product:nth-child(3n+1), .woocommerce .upsells.products ul.products li.product:nth-child(3n+1) {clear: none !important; }
    body.woocommerce .related ul.products li.product:nth-child(5n+1), .woocommerce .upsells.products ul.products li.product:nth-child(5n+1) {clear: both !important; }

    @media only screen and (max-width: 767px) {
    body.woocommerce .related ul.products li.product, .woocommerce .upsells.products ul.products li.product { width: 48% !important;}
    body.woocommerce .related ul.products li.product:nth-child(5n+1), .woocommerce .upsells.products ul.products li.product:nth-child(5n+1) {clear: none !important; }
    body.woocommerce .related ul.products li.product:nth-child(2n+1), .woocommerce .upsells.products ul.products li.product:nth-child(2n+1) {clear: both !important; }
    }
Sign In or Register to comment.