Currently im using “Converio” wordpress theme. Related products is working by default on the basis of same category/sub-category, I want related products to be displayed based on “keyword”,”title”,”description”.


Am I correct that you're meaning products as in WooCommerce products?

If so:

Right before WooCommerce returns the related products for a current product(if you're not on a product page you could define a post_id yourself). It uses a filter which you can hook into.

$related_posts = apply_filters( 'woocommerce_related_products', $related_posts, $product_id, array(
    'limit'        => $limit,
    'excluded_ids' => $exclude_ids,
) );

By using the following filter within your child-theme/theme:

add_filter( 'woocommerce_related_products, function( $related_posts ) {
    // Add or replace products to $related_posts.     

    return $related_posts;
}, 10, 1 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.