Number of related products doesn’t change

This topic has 38 replies, 3 voices, and was last updated 1 years, 7 months ago ago by Rose Tyler

  • Avatar: Jef
    filmguerilla
    Participant
    September 16, 2022 at 01:49

    FYI

    The 4 items works when i change the settings to SLIDER. But i don’t want a slider if possible for single product page related items..

    https://prnt.sc/2PtgSbEkDDO2

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 16, 2022 at 08:54

    Hello,

    I’ve set https://prnt.sc/PtZI_-MU4tex Please clear cache and check the result now – https://prnt.sc/MoUhdTDDyOH0 (not in customizer but on the live single product page).

    Regards

    Avatar: Jef
    filmguerilla
    Participant
    September 16, 2022 at 23:22

    I remember the related product css that was added was for the fix for the setting because it’s showing lots of products in it. This was long ago. Don’t remember exactly but it was there for a reason.

    Cleared cache on both Firefox and Chrome. https://prnt.sc/aVlH4b9EEZPO
    The related products is showing 50 products on single product page.
    Didn’t fixed it. Can you check it again please?

    Avatar: Jef
    filmguerilla
    Participant
    September 17, 2022 at 02:49

    Any help?

    Avatar: Jef
    filmguerilla
    Participant
    September 19, 2022 at 01:24

    good morning. i hope someone could help me out fix this problem this week. it’s been 2 days since someone answered me here.

    Avatar: Jef
    filmguerilla
    Participant
    September 19, 2022 at 02:40

    FYI. i’ve disabled the related product on my website now. Since it’s too annoying to show 50 items on related products.

    This should be fix since this is a theme issue.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 19, 2022 at 13:06

    Hello,

    This code shows 50 related products – https://prnt.sc/Rx0DQELgTh4e , so delete or change the code.

    Regards

    Avatar: Jef
    filmguerilla
    Participant
    September 20, 2022 at 03:38

    What code should i put here? Can anyone tell me?

    Avatar: Jef
    filmguerilla
    Participant
    September 20, 2022 at 03:53

    Seems like this is fixed but it looks weird when editing. https://prnt.sc/v7o8ugXacLna

    I want to change the related product text. Would there be an easier way than putting translation?

    Thanks

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 20, 2022 at 07:11

    Hello,

    “it looks weird when editing” – is it fine when the editor is closed? Incorrect displaying in the editor can be also caused by your custom changes in the child theme.
    “I want to change the related product text. Would there be an easier way than putting translation?” – https://prnt.sc/VxzgzMu1-AFS , check now – https://prnt.sc/3SwjVdBBuiEV > https://prnt.sc/QEG5SxfReH7J You can change the text as on the screenshot, or disable the Loco Translate plugin and changes will be visible still.

    Regards

    Avatar: Jef
    filmguerilla
    Participant
    September 20, 2022 at 10:16

    Seems fine when published. Nots sure what causing this problem. I dont have that much custom changes on this website. Or maybe the old custom we made for this site makes it wonky.

    Wow that’s neet. Will check it out and play with the plugin later. I’m on the process of optimizing the site. Can you give me an idea where to start?

    Thank you Rose!

    Avatar: Jef
    filmguerilla
    Participant
    September 20, 2022 at 10:21

    Oh last thing.

    Before this changes. I had my Related Products only show the in stock products. Excluded are the old and out of stock products. Right now it’s mixed again.. Looking for a good solution but i can’t find a good one. I remembers the CSS was there for this..

    I know this code was added before to fix this. But now this code doesn’t work properly on the settings anymore..

    /* Related products */
    
    .related-products {
        --columns: 6;
        display: grid;
        grid-template-columns: repeat(var(--columns),1fr);
    }
    
    @media only screen and (min-width: 481px) and (max-width: 992px) {
        .related-products {
            --columns: 3;
        }
    }
    
    @media only screen and (max-width: 480px) {
        .related-products {
            --columns: 1;
        }
    }
    
    .related-products div.product {
        width: 100% !important;
    }
    
    .related-products:before,
    .related-products:after,
    .related-products .outofstock,
    .related-products .instock ~ .instock ~ .instock ~ .instock ~ .instock ~ .instock ~ .product {
        display: none;
    }
    
    .related-products div.product {
        clear: none !important;
    }

    Can you help me on this?

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 21, 2022 at 08:57

    Hello,


    it is better to reach with php filters/actions but not with CSS styles.
    As we see you have previously rewritten file of related.php but it is renamed now -> https://prnt.sc/Hc66fShe7tbl . As you see we provided you before the filter to hide out of stock items -> line 21 (which is commented now) and line 172 (which is commented now as well) -> https://prnt.sc/0FxUv1MoMslF . You may renamed your related09162022.php-> related.php and uncomment those lines described above and check then.

    Example: https://prnt.sc/Iz_kZNTdyucE ( before ) = all products instock/outofstock
    https://prnt.sc/-tx3TAbXwgw1 (after) = only in stock products

    The custom function is located in your child-theme/functions.php -> https://prnt.sc/ycfdAbymXzBh

    Regards

    Avatar: Jef
    filmguerilla
    Participant
    September 21, 2022 at 09:47

    Ohh you guys are the one who made that. I forgot. I’ll try your instruction. I’ll let you know if i encounter any problem. Was trying to minimize the use of the template in woocomerce childtheme folder to atleast know which are the ones who are making the site load so slow.. Will do an update in a bit.

    Avatar: Jef
    filmguerilla
    Participant
    September 21, 2022 at 09:56

    Done

    https://prnt.sc/0BXDuacwcVe8

    https://prnt.sc/eGDz0-JRfo0E

    https://prnt.sc/dDabtzVMo61l

    There seem to be a problem. Sometimes it only loads 1 or 2 products. Sometimes none. Do i need to wait or add something to related.php?

    Thank you very much

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 21, 2022 at 14:28

    Hello,

    You had next part of code -> https://prnt.sc/aWD-UB0-cMWL which prevented to show products which are not visible. But now you have added the filter to prevent outofstock product from showing.
    We commented that part for you ( https://prnt.sc/785ll6fcvYgJ ) so you may check now !
    Also, you should know that if there are no products to show then there will be no products (it is logic)

    Regards

    Avatar: Jef
    filmguerilla
    Participant
    September 22, 2022 at 06:16

    Wow thank you very much for the tweak. As i’m not really a programmer this give me more info how it works. Learned from this. Will keep an eye for this and report back in a few days. if all goes well will mark this as solved.

    Thanks a lot!

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    September 22, 2022 at 07:49

    Hello,

    You’re welcome!

    Regards

  • 1 2
    Viewing 38 results - 21 through 38 (of 38 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.