Get Posts From A Certain Post Type In An ID Array

I am assuming this– “That function has to be eliminate ids which is not a producy”– means “I only want to pull the post associated with the ID if that post is a product”. In that case a simple query should do it:

$pqry = new WP_Query(
  array(
    'fields' => 'ids', // if you only want the Post IDs
    'post_type' => 'product',
    'post__in' => array(20,34,65,126)
  )
);

Reference:

http://codex.wordpress.org/Class_Reference/WP_Query