WP Woocommerce linked product search in admin - too much score

Viewed 30

I would like to modify the behavior of upsells and cross-sells product search in the admin product edit. It should search only in product titles.

By default, it searches description as well. That’s why there are too many score, I can’t find the product what I search.

[here is the woocommerce1

I had the same problem with the frontend product finder, but I solved it with a hook. Is there any hook for upsell and cross-sell finder? Thanks!

1 Answers

The search request goes to this function https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php#L1582

There you can find a filter woocommerce_product_pre_search_products for a custom result, so basically you'll have to copy-paste the whole code below that filter line and remove a few things from line no 1651 or you can just modify the core plugin files.

However, I don't see any specific param to identify the request so this change will affect everywhere on the website where search_products is used from the data store.

Related