WP CF7 custom var

Make sure you’ve read the shortcode API. A shortcode must be a callback (i.e. a function), not a value. And add_shortcode only works for the shortcode name, not an attribute:

dynamichidden is the name of the shortcode, and CF7_custom_prod_code is an attribute. You won’t be able to hook into it using add_shortcode( 'CF7_custom_prod_code' ). You can however use the do_shortcode_tag filter to modify the output of any shortcode handler:

add_filter( 'do_shortcode_tag', function ( $html, $name, $attr ) {
    if ( $name === 'dynamichidden' && in_array( 'CF7_custom_prod_code', $attr ) ) {

        // Do something with $html

    }

    return $html;
}, 10, 3 );