Home / Forums / WoodMart support forum / Restrict related products on Single Product pages to parent category only
Home › Forums › WoodMart support forum › Restrict related products on Single Product pages to parent category only
Restrict related products on Single Product pages to parent category only
- This topic has 10 replies, 2 voices, and was last updated 7 years, 11 months ago by
Artem Temos.
-
AuthorPosts
-
December 22, 2017 at 8:10 pm #30165
jinsley8ParticipantHi,
Right now the related products section is showing randon products from other categories.
How do I get it to show only parent categories?
December 22, 2017 at 8:21 pm #30166
jinsley8ParticipantIf I copy over the default woocommerce related.php file it fixes it by showing only directly related products but the styling obviously isn’t the same.
December 22, 2017 at 9:30 pm #30172
Artem TemosKeymasterHello,
Do you mean that default WordPress theme will show different related products than our theme? Actually, related products query is located in WooCommerce core and is not overrided by our theme.
Regards
December 22, 2017 at 11:27 pm #30186
jinsley8ParticipantReally? I copied the related.php file from the woocommerce plugin template folder to replace the file in your theme and it showed me only related products in the same category as the product I view.
Before, your theme was showing me random products from other categories.
December 23, 2017 at 8:29 am #30203
Artem TemosKeymasterStrange, could you please provide us your admin and FTP access so we can check it and fix if there is a bug in the theme?
December 23, 2017 at 5:25 pm #30258
jinsley8ParticipantIf you go to the link I sent it shows a AC Milan product and the related are all random.
If I copy the woocommerce version of related.php over to the theme then it shows all AC Milan related.
December 23, 2017 at 6:23 pm #30284
Artem TemosKeymasterBut we tested with default related.php file and this section always show random products
Could you please describe us how do you achieve this result? Or maybe do this temporarily so we can see how it works.
December 24, 2017 at 12:51 am #30307
jinsley8ParticipantSorry I sent you the wrong web link before.
I uploaded a custom related.php file to my child theme using the following code:
Since the products have 2 separate categories – brand and product type:
This gym bag is in AC Milan and Gym Bags categories.
This new related.php allows related to only show those products related.
December 24, 2017 at 8:16 am #30326
Artem TemosKeymasterSo can you provide us the admin and FTP access to this website so we can check it there?
December 24, 2017 at 10:42 pm #30404
jinsley8ParticipantYes, it was in a post above.
December 24, 2017 at 10:50 pm #30405
Artem TemosKeymasterSo you have default related.php now that comes with WooCommere plugin, right? Each time we reload the page we see random related products.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register