Search Woocommerce product titles only

It turns out the free Relevanssi plugin does this rather well. I was afraid it would only search posts and not custom post types, but it does it all… and rather well! It only requires a simple filter added to your theme’s functions.php file to get it to omit the body content:

// search titles only (relevanssi plugin)
add_filter('relevanssi_index_content', 'contentoff');
function contentoff() {
    return false;
}

alternatively you can have it omit titles (don’t use the two together or you’ll be searching nothing!

// search titles only (relevanssi plugin)
add_filter('relevanssi_index_titles', 'contentoff');
function contentoff() {
    return false;
}