Tagged: related products, woocommerce
-
AuthorPosts
-
October 23, 2016 at 4:04 pm #703008
Hi there everyone
I have product detail pages set up on my development site, and at the bottom use a “related products” element with the intention to show up to 4 products from the same sub-category of the focus product. this works ok if the Parent Category only has 1 sub-category.
However, if I have a Parent category with several other sub-categories, I run into difficulty with what is displayed.
Example:
Parent Category: Libeluile (brand)
Sub Category 1: Gourmet Oils
Sub Category 2: Gourmet Vinegars
Sub Category 3: Gift BoxesIf I have a Product detail page from Gourmet Vinegars, I want the “related products” element to only show up to 4 other Gourmet Vinegars from that range. But, unfortunately this element is currently displaying Gourmet Vinegars but also products from the other 2 sub categories of Gourmet Oils and Gift Boxes. I am guessing because it refers to the Parent category for selection.
Is there a way to tweak the settings/code so that the related products element on these pages only displays products from that same subcategory rather than all of them from the parent category?
I did think I could use Linked Products/Upsells when creating the product, and then specify 4 from the same sub category, and then specify “Upsells only” in the Related Product element on the Product Detail page. Which should theoretically work, but I wondered if there were a more automated method that wouldn’t require me to set it up manually each time?
October 26, 2016 at 5:58 am #704111Hey craigriches,
Thank you for using Enfold.
Please create a woocommerce/templates/single-product directory in your child theme folder then add a related.php file. In the file, use this code. http://pastebin.com/LKRRSNXV
Based on: https://github.com/woocommerce/woocommerce/issues/850
I’m not sure if that is going to work but it’s worth a try. There is no available filter for the woocommerce_related_products function query so it’s the only solution we got for now.
Best regards,
IsmaelNovember 14, 2018 at 9:14 pm #1033671Hello… BUMP, MAJOR BUMP!!!
What can I do to get this code working again? Meaning, what do I have to erase in the woocommerce enfold config that is overriding the child theme function that used to work?
November 16, 2018 at 7:14 am #1034306 -
AuthorPosts
- You must be logged in to reply to this topic.