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

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #30165

    jinsley8
    Participant

    Hi,

    Right now the related products section is showing randon products from other categories.

    How do I get it to show only parent categories?

    #30166

    jinsley8
    Participant

    If 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.

    #30172

    Artem Temos
    Keymaster

    Hello,

    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

    #30186

    jinsley8
    Participant

    Really? 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.

    #30203

    Artem Temos
    Keymaster

    Strange, 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?

    #30258

    jinsley8
    Participant

    If 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.

    #30284

    Artem Temos
    Keymaster

    But we tested with default related.php file and this section always show random products

    https://prnt.sc/hrgtbi

    https://prnt.sc/hrgsz7

    Could you please describe us how do you achieve this result? Or maybe do this temporarily so we can see how it works.

    #30307

    jinsley8
    Participant

    Sorry I sent you the wrong web link before.

    I uploaded a custom related.php file to my child theme using the following code:

    https://pastebin.com/LKRRSNXV

    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.

    #30326

    Artem Temos
    Keymaster

    So can you provide us the admin and FTP access to this website so we can check it there?

    #30404

    jinsley8
    Participant

    Yes, it was in a post above.

    #30405

    Artem Temos
    Keymaster

    So you have default related.php now that comes with WooCommere plugin, right? Each time we reload the page we see random related products.

Viewing 11 posts - 1 through 11 (of 11 total)