This topic has 38 replies, 3 voices, and was last updated 2 years, 2 months ago ago by Rose Tyler
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!
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?
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
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.
Done
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
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
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!
Hello,
You’re welcome!
Regards
You must be logged in to reply to this topic.Log in/Sign up