How to use a WooCommerce action hook?

If you don’t intend your meta field to be specific to a particular product type you can do the following ( which is what I do in my own WooCommerce extension ).

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

add_action( 'woocommerce_process_product_meta', 'new_post_meta' );

or to limit this to a particular product type:

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

add_action( 'woocommerce_process_product_meta_simple', 'new_post_meta' );

Where ‘simple’ is the product type.