I added some data with the function :
woocommerce_register_additional_checkout_field(
array(
'id' => 'namespace/newsletter-opt-in',
'label' => 'Subscribe to newsletter ?',
'location' => 'order',
'type' => 'checkbox',
)
);
I try to check this checkbox but I can’t get the value
However, the data is well returned in my order data column
I tried :
$order = wc_get_order($order_id);
$subscribe = $order->get_meta('namespace/newsletter-opt-in');
But $subscribe
is empty