Display products from the primary category | related product

#158154
  • Resolved Flo seo
    Rank Math free

    Hello I need your help!
    Indeed, I would like the products of the primary category to be displayed. Currently the related products are mixed with the other categories and do not only take into account the primary category.

    I would like to have only the products of the primary category displayed in the “related product”.

    Please how to do this ?

    I have see some code but is for Yoast seo

    Thanks for your help !

    Flo

Viewing 1 replies (of 1 total)
  • Hi Flo,

    The selection of what goes into the related products is really something that is handled by woocommerce or your theme depending on what features it has.

    Rank Math does not really have a specific feature for this.
    You might need to do you own modifications on your own to get this working as you want.
    There is a copy of how this can be done through with Yoast here https://wpexplorer-themes.com/total/snippets/yoast-seo-primary-category-related-products/

    The method to get the primary category is used and then after they tie into the related products hook from woocommerce to alter it.

    Rank Math’s hooks are listed here https://rankmath.com/kb/filters-hooks-api-developer/. Look for the hooks relating to breadcrumbs and the primary term. You could maybe use that to come up with your own version of Yoast one.

    Alternatively you can use a plugin like shown here https://www.cloudways.com/blog/custom-related-products-in-woocommerce-store/ to set up the related plugins as you want.

    Hope this clears things up.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Display products from the primary category | related product’ is closed to new replies.