This gave you the total of what is in the cart for categories based on the master_categories_id when set to 11 or 12 ...
Code:
$chk_cats = $_SESSION['cart']->in_cart_check('master_categories_id','11')  + $_SESSION['cart']->in_cart_check('master_categories_id','12');
This would work for products:
Code:
$chk_prods = $_SESSION['cart']->in_cart_check('products_id','11')  + $_SESSION['cart']->in_cart_check('products_id','12');
have more than 2 products_id values to check, keep adding them on ...

Now you want to check how many products are in the cart you have $chk_prods ...

You want to check the $type for the shipping method ...

Not sure what the shipping method is, then do an echo on it by uncommenting the:
Code:
//          echo 'shipping ' . $type . ' chk_cats: ' . $chk_cats . '<br>';
NOTE: you can also add to that echo the $chk_prods to see the results ...