# Checkout Fields Manager - Getting Meta Data

 The [Checkout Fields Manager](https://easydigitaldownloads.com/downloads/checkout-fields-manager/) extensionallows you to make custom fields for your checkout form. This makes it easy to gather data from your customers. You can see it easily on the Payment History page, but what if you want to have it printed on the receipt for the customer to see? This document will help with that.

### Radio Buttons Example

 In this example we&#039;re going to use a custom radio buttons field, titled &quot;Are you happy with this purchase process?&quot;. The meta key for this field was automatically generated as `are_you_happy_with_this_purchase_process`, and we&#039;ve simply made a Yes/No answer option. See below.

 ![](https://easydigitaldownloads.com/wp-content/uploads/2022/07/6184cce5bd556.png)

 Since we&#039;re going to be rendering this information on the customer receipt, let&#039;s take a look at that template. The template we want is called shortcode-receipt.php. [Read our docs on how to move this template to your theme](https://easydigitaldownloads.com/docs/moving-edd-templates-to-your-theme/).

 Near the top of that file you&#039;ll find this code:

```
$payment = get_post( $edd_receipt_args[&#039;id&#039;] );
```

 which creates an object for this payment. In the rest of this file we can now find the ID for this payment under `$payment-&gt;ID`.

 In the example above the Meta Key is `are_you_happy_with_this_purchase_process`. Now that we have both the ID and the Meta Key we can get the value with this code:

```
get_post_meta( $payment-&gt;ID, &#039;are_you_happy_with_this_purchase_process&#039;, true )
```

 **Note**: the &#039;true&#039; in the example above indicates that we&#039;re expecting a single value from get\_post\_meta(). Checkout Fields Manager returns a single value for all field types it offers.

### Printing to the Receipt

 In the above example we got the value we wanted, but now we want to render it nicely in receipts. In `shortcode-receipt.php` you&#039;ll find a HTML table with a CSS ID of edd\_purchase\_receipt. You can copy this table and change the values. Here&#039;s an example of a table header:

```
```

   **_e( &#039;My Store Questions&#039;, &#039;easy-digital-downloads&#039; ); ?**    Then we can print a table row for the above question, like this:

```
&lt;tr&gt;
    &lt;td class=&quot;are_you_happy_with_this_purchase_process question&quot;&gt;&lt;strong&gt;&lt;?php _e( &#039;Are you happy with this purchase process?&#039;, &#039;easy-digital-downloads&#039; ); ??&gt;&lt;/strong&gt;&lt;/td&gt;
    &lt;td class=&quot;are_you_happy_with_this_purchase_process answer&quot;&gt;&lt;?php echo strip_tags( esc_html( get_post_meta( absint( $payment-?&gt;ID ), &#039;are_you_happy_with_this_purchase_process&#039;, true ) ) ); ?&gt;&lt;/td&gt;
&lt;/tr&gt;
```

### Multi-answer Example

 Some field types allow for multiple answers from a customer. Check boxes allow the customer to select multiple things for example. This is still stored as a single item in meta data; it&#039;s a single array with multiple key/value pairs. How it gets rendered is slightly different from above, however.

 Here&#039;s a custom field asking the customer what their favorite animal is:

 ![](https://easydigitaldownloads.com/wp-content/uploads/2022/07/6184cce61a057.png)

 Rendering it in our HTML table would look like this:

```
&lt;tr&gt;
    &lt;td class=&quot;favorite_animal question&quot;&gt;&lt;strong&gt;&lt;?php _e( &#039;Favorite animal?&#039;, &#039;easy-digital-downloads&#039; ); ??&gt;&lt;/strong&gt;&lt;/td&gt;
    &lt;?php // create an empty variable for the answers
        $animals = &#039;&#039;;

	// loop through the answers, creating list items
        foreach ( get_post_meta( $payment-?&gt;ID, &#039;favorite_animal&#039;, true ) as $animal ) {
            $animals .= &#039;&lt;li&gt;&#039; . $animal . &#039;&lt;/li&gt;&#039; . &quot;n&quot;; 
        }

	// print out the table row, wrapping the results in unordered list tags, and escaping with wp_kses_post()
    ?&gt;
    &lt;td class=&quot;favorite_animal answer&quot;&gt;&lt;ul&gt;&lt;?php echo wp_kses_post( $animals ); ??&gt;&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
```

 As you can see it&#039;s only slightly more complicated than the first example.

### Wrapping Up

 Putting together the two code samples from above, we end up with something like this:

```
```

   **_e( &#039;My Store Questions&#039;, &#039;easy-digital-downloads&#039; ); ?**     **_e( &#039;Are you happy with this purchase process?&#039;, &#039;easy-digital-downloads&#039; ); ?** echo strip_tags( esc_html( get_post_meta( absint( $payment-ID ), &#039;are\_you\_happy\_with\_this\_purchase\_process&#039;, true ) ) ); ?&gt;   **_e( &#039;Favorite animal?&#039;, &#039;easy-digital-downloads&#039; ); ?** // create an empty variable for the answers
            $animals = &#039;&#039;;

            // loop through the answers, creating list item
            foreach ( get_post_meta( $payment-ID, &#039;favorite\_animal&#039;, true ) as $animal ) { $animals .= &#039;4. &#039; . $animal . &#039;
&#039; . &quot;n&quot;; } // print out the table row, wrapping the results in unordered list tags, and escaping with wp\_kses\_post() ?&gt; echo wp_kses_post( $animals ); ?
   Which will look like this: ![](https://easydigitaldownloads.com/wp-content/uploads/2022/07/6184cce671397.png)

### Key Points

- To render Custom Fields answers on your receipts, copy the shortcode-receipt.php file to your theme and put your code in there
- Getting the data is simply doing a get\_post\_meta() call on the Meta Key provided in you the admin area
- All keys from Custom Fields Manager are stored as singles in the post\_meta table.

 **Note:** Easy Digital Downloads does not provide support for custom coding/development. If needed we recommend hiring a developer through [Codeable](https://easydigitaldownloads.com/customize-easy-digital-downloads/) make the custom changes you need.