• Resolved tin_soldier

    (@tin_soldier)


    I’ve looked high and low but can’t find the answer to this.

    Related Products are generated from categories first and then tags.

    How do you change the order of this so the query will draw from products associated by tags first and only show category related ones if there are no matching tags?

    I know these filters are something to do with it but haven’t managed to reorder them in a function.

    woocommerce_product_related_posts_relate_by_category
    woocommerce_product_related_posts_relate_by_tag

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter tin_soldier

    (@tin_soldier)

    Was hoping that this might work (added to functions.php)

    add_filter( 'woocommerce_product_related_posts_relate_by_category', '__return_false' );
    add_filter( 'woocommerce_product_related_posts_relate_by_tag', '__return_false' );
    add_filter( 'woocommerce_product_related_posts_relate_by_tag', '__return_true' );
    add_filter( 'woocommerce_product_related_posts_relate_by_category', '__return_true' );

    Removing both functions and bringing them back in with Tags first. It doesn’t work though. Products associated by category still show first.

    Anyone?

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @tin_soldier

    You could try the proposed solution here:

    https://nicola.blog/2015/03/02/hide-related-products-by-category-or-tag-in-woocommerce/

    You can also comment on that article for more development help.

    Thread Starter tin_soldier

    (@tin_soldier)

    Yeah, that’s the same code I posted above which didn’t work.

    Resorted to using the Custom Related Products plugin but that is huge amounts of manual work customising each product.

    We should be able to prioritise Tags over Categories or vice versa instead of having the query randomly selecting from both.

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @tin_soldier

    Thanks for letting us know. Another option would be to post this idea on the Ideas Board to allow others to vote on the idea. The more votes an idea gets, the higher the probability to see it in the future:

    https://ideas.woocommerce.com/forums/133476-woocommerce?category_id=337633

    Thanks again,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Related Products order of preference’ is closed to new replies.