I have added the data by this code. It's inserted successfully. But how can I get the meta by function? I have tried with get_post_meta()
but it's not working.
add_action( 'woocommerce_checkout_create_order_line_item', 'add_custom_order_line_item_meta',10,4 );
function add_custom_order_line_item_meta($item, $cart_item_key, $values, $order){
if(array_key_exists('course_name_one', $values) {
$item->add_meta_data('Test ID',$values['course_name_one']);
}
}