Accessing Drupal array values
Devel is super useful to help you figure out these type of things.

Once enabled, you can write dpm($product_id) and it will print out a nice organized structure of the array.  From there, you can click on any item and it will show you how you can access the item like ['und'][0]['product_id'] in your example.

Depending on what exactly you're trying to do, there may be different ways to get the info you need.