search sku. Closes #1334.

This commit is contained in:
Mike Jolley 2012-08-03 18:19:35 +01:00
parent ea1e9b74ed
commit 58dd2aca67
1 changed files with 15 additions and 1 deletions

View File

@ -912,7 +912,21 @@ function woocommerce_json_search_products( $x = '', $post_types = array('product
'fields' => 'ids'
);
$posts = array_unique(array_merge( get_posts( $args ), get_posts( $args2 ) ));
$args3 = array(
'post_type' => $post_types,
'post_status' => 'publish',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => '_sku',
'value' => $term,
'compare' => 'LIKE'
)
),
'fields' => 'ids'
);
$posts = array_unique(array_merge( get_posts( $args ), get_posts( $args2 ), get_posts( $args3 ) ));
} else {