Okay
  Public Ticket #2345726
Related products/upsell item limit on mobile
Closed

Comments

  •  4
    Marcin started the conversation

    Hi!

    How can I limit related products number to two only on mobile? It shows all of them?

    Please see attached.

  •  9,059
    Tahir replied

    Hey Again,

    Add this into the Custom CSS box located in your Salient Options panel (All custom css provided is tested in the Live Browser so it will work as intended . If you cant see any changes make sure there is no red cross in the Custom CSS Box as that syntax error would cause all css below it to not show up on the Frontend):

    @media only screen and (max-width: 999px) and (min-width: 1px) {
        .woocommerce-page .related ul.products li.product {
            display: none !important;
        }
        .woocommerce-page .related ul.products li.product:nth-child(1) , .woocommerce-page .related ul.products li.product:nth-child(2) {
            display: block !important;
        }
    }

    Thanks


    ThemeNectar Support Team 

  •  4
    Marcin replied

    Perfect, thank you.

    How can I expand it for upsell products as well?

  •  4
    Marcin replied

    And only 3 products on desktop?

    This what my Client asked for...

  •  9,059
    Tahir replied

    Where can i see the upsell products. Could you provide a page url ? 

    Add this into the Custom CSS box located in your Salient Options panel (All custom css provided is tested in the Live Browser so it will work as intended . If you cant see any changes make sure there is no red cross in the Custom CSS Box as that syntax error would cause all css below it to not show up on the Frontend):

    @media only screen and (min-width: 1000px) {
       .woocommerce .products.related .product:last-child {
            display:none !important;
        }
    }

    Thanks


    ThemeNectar Support Team 

  •  4
    Marcin replied

    Thank you,


    Here is a product with upsell

    https://zeinas.se/produkter/zeinas-falafel/

  •  9,059
    Tahir replied

    Add this into the Custom CSS box located in your Salient Options panel (All custom css provided is tested in the Live Browser so it will work as intended . If you cant see any changes make sure there is no red cross in the Custom CSS Box as that syntax error would cause all css below it to not show up on the Frontend):

    /* hide 4th upsell on desktop */
    @media only screen and (min-width: 1000px) {
        .woocommerce .products.upsells .product:nth-child(4) {
            display:none !important;
        }
    }
    /* hide 3rd and 4th on mobile */
    @media only screen and (max-width: 999px) and (min-width: 1px) {
        .woocommerce-page .upsells ul.products li.product:nth-child(3) , .woocommerce-page .upsells ul.products li.product:nth-child(4) {
            display: none !important;
        }
    }

    Thanks


    ThemeNectar Support Team 

  •  4
    Marcin replied

    Thank you!

    I can guess what my Client ask now: We have now 3 products on desktop, but in 3 of 4 columns.

    It should be in 3 columns like products above...

    Hope not....

  •  9,059
    Tahir replied

    Add this into the Custom CSS box located in your Salient Options panel (All custom css provided is tested in the Live Browser so it will work as intended . If you cant see any changes make sure there is no red cross in the Custom CSS Box as that syntax error would cause all css below it to not show up on the Frontend):

    @media only screen and (min-width: 1000px) {
        .woocommerce .products.related .product, .woocommerce .products.upsells .product {
            width: 31% !important;
        }
    }
    @media only screen and (max-width: 1000px) {
        .woocommerce .products.related .product, .woocommerce .products.upsells .product {
            width: 48% !important;
        }
    }

    Thanks


    ThemeNectar Support Team 

  •  4
    Marcin replied

    Perfect, thank you Tahir!