Skip to content
Audited Snippet:

Add a custom field (in an order) to the emails Audit Passed: Yes

Audited on February 3, 2023 by jcullen

php Versions Tested

  • 7.4
  • 8.0
  • 8.1

WordPress Version

6.1.1

WooCommerce Version

7.3.0

Audit Notes:

Snippet still functional


Additional Relevant Versions:

  • WooCommerce Checkout Field Editor – 1.7.4

Additional Notes:

The code source seems to have been updated to use an array, most likely to provide support for multiple custom fields. Due to this, the code sample was no longer relevant so I have updated it to the following:

    $fields['hear_about_us'] = array(
        'label' => __( 'How did you hear about us?' ),
        'value' => get_post_meta( $order->id, 'hear_about_us', true ),
    );

Scroll To Top