$s = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; $args = array( 'post_type' => 'product', 'posts_per_page' => 12, 'meta_query' => array( array( 'key' => '_sku', 'value' => $s, 'compare' => 'LIKE' ) ), 's' => $s ); $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); wc_get_template_part('content', 'product'); } } else { echo '

Нічого не знайдено

'; } wp_reset_postdata();