Run Function if Order Meta Exists – WooCommerce

WooCommerce orders are posts and behave the same as any WordPress post. So you can use the same WordPress functions to update or read the post meta data.

<?php $meta_values = get_post_meta($post_id, $key, $single); ?>

For your example I’d suggest:

$match_order_meta = get_post_meta( $order->ID, 'My_Checkbox', TRUE);

The ‘TRUE’ flag tells WordPress to return the value as a string. Without the TRUE flag you’ll get an array. Again take a look at the docs below.

You might also:

echo '<!-- $order->ID -->';

To make sure you have the correct ID.

Here are the docs get_post_meta().