Show custom field value in cart in WooCommerce
<p>I'm using Wordpress together with WooCommerce for my shop.<br>
I want to output the value of my custom field in my cart and in the email order confirmation.</p>

<p>I have created a custom field in my functions.php:</p>

<pre><code>// Display Fields
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );

// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );

function woo_add_custom_general_fields() {

  global $woocommerce, $post;

  echo '&lt;div class="options_group"&gt;';

// Input
woocommerce_wp_text_input( 
    array( 
        'id'                =&gt; '_gram', 
        'label'             =&gt; __( 'somelabel', 'woocommerce' ), 
        'placeholder'       =&gt; '', 
        'description'       =&gt; __( 'sometext', 'woocommerce' ),
        'type'              =&gt; 'number', 
        'custom_attributes' =&gt; array(
                'step'  =&gt; 'any',
                'min'   =&gt; '0'
            ) 
    )
);

  echo '&lt;/div&gt;';

}

function woo_add_custom_general_fields_save( $post_id ){
    // Number Field
    $woocommerce_number_field = $_POST['_gram'];
    if( !empty( $woocommerce_number_field ) )
        update_post_meta( $post_id, '_gram', esc_attr( $woocommerce_number_field ) );

}
</code></pre>

<p>On my pages I'm using:</p>

<pre><code>get_post_meta( get_the_ID(), '_gram', true );
</code></pre>

<p>To show the value and that work perfect.</p>

<p>Now I want to show this same value under the product name in my cart and in the email confirmations.
But I cant figure out how to do this.</p>

<p>Does anyone knows how to do this?</p>