The fields created using our plugin are saved using the function wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) . You can retrieve the value of the fields from the database by using the below function.
wc_get_order_item_meta( $item_id, $key, $single = true )
We hope this will help 🙂
Thank you!
We hope your issue is resolved now. We are going to mark this thread as resolved.
Please do let us know if you have any further questions. We are happy to help 🙂
Thank you!
I have a question related to this.
how can I access the parameters $item_id, $key. The only ressource I have is $order_ID, which I use to get the Order Object:
$order = wc_get_order($order_ID);
how do I get to $item_id and $key?
Ok Ive got it
$order = wc_get_order( $order_ID );
$items = $order->get_items();
foreach ( $order->get_items() as $item_id => $item ) {
// Here you get your data
$custom_field = wc_get_order_item_meta( $item_id, ‘uniqueid’, true );
// To test data output
print_r($custom_field);
}