How to copy an order item meta from the parent to the child order in a Woocommerce Subscription?

I’m running a function hooked to woocommerce_order_status_completed that uses an API to get a phone number and pin from an external source and save that in a meta key on some order items. Some of these order items are subscriptions.

When a Woocommerce subscription renewal order runs automatically, it fires the API and gets a new set of call-in data. I need to check if a completed order is a subscription renewal and if so skip the API call and just get the renewed item’s parent meta data and insert it into the child items meta.

The top portion of the code I have tried here is not working. The API call portion of the code in the else{} is working so I have truncated it.

add_action ( 'woocommerce_order_status_completed', 'add_item_meta_or_run_api', 10 , 1);  function add_item_meta_or_run_api( $  order_id ) {  $  order = wc_get_order( $  order_id );   if (wcs_order_contains_subscription( $  order, 'renewal' )){ //check if the order contains a renewal subscription    foreach ($  order->get_items() as $  item_id => $  item_obj) { //loop through each rewnewal item        $  parent_id = $  item_obj->get_parent_id(); // Get the parent order ID for the subscriptions.       $  parentSubscriptions = wcs_get_subscriptions_for_order( $  parent_id );//get parent order subscriptions                 foreach (  $  parentSubscriptions->get_items() as $  parent_item_id => $  subscription_item_obj) { //loop through parent order items and get the meta.                   $  ParentCallinData = $  subscription_item_obj->get_meta('call_in_data');               // Store parenent item call in data in renewal order item meta         wc_update_order_item_meta($  item_id,'call_in_data',   $  ParentCallinData, true);             }    } }   else {//if there is not a subscription renewal in the order then we run the Api       foreach ($  order->get_items() as $  item_id => $  item_obj) {    //Code here has been removed that builds and runs the API call to dynamically get the call-in data and store it in $  APIresponse          wc_update_order_item_meta($  item_id,'call_in_data',  $  APIresponse, true); //the APIresponse is added to an order item meta key     }    }   }