add_filter( "wpo_custom_product_search", function($ids,$query_args,$term){
// check if it's product id
$product = wc_get_product($term);
if( $product )
$product_id = $product->get_id();
else // try search by SKU
$product_id = wc_get_product_id_by_sku($term);
// use default search if we return FALSE
return $product_id ? array($product_id) : false;
},10,3);Search products by id or sku Print
Created by: Alex Prokaev
Modified on: Wed, 15 Apr, 2020 at 2:25 PM
Did you find it helpful? Yes No
Send feedbackSorry we couldn't be helpful. Help us improve this article with your feedback.