I am wondering how you would implement the following hook.

```
do_action( 'woocommerce_process_product_meta_' . $product_type, $post_id );

```

What is the correct way to call a call the action from a plugin file.
Bellow is the code that I am currently using but its not working.

```
global $post, $thepostid, $woocommerce;

function new_post_meta () {
    if (isset($_POST['location'])) 
        update_post_meta( $post_id, 'location', json_encode($_POST['location']) );      
}

add_action( 'woocommerce_process_product_meta_' .$product_type, 'new_post_meta' );

```