WP Woocommerce sales API call -- 2

Job ID: 32353347

Budget: $30 – $250 USD

At the moment we call a workflow in our crm with each item (id) from the order as code below in functions.php.

We need to change that to one call once the order is placed with the order id and each product id as in
https://crm.com/shorturl.php?id=6196f88b5619e1.63635494&workflow_id=87&order=1234&prod1=445&prod2=446&prod3=447...

############################## current call ####################
//send sold call to each product in crm
add_action( 'woocommerce_checkout_order_processed', 'send_data_for_wc_order', 10, 3);
function send_data_for_wc_order($order_id, $posted_data, $order) {
$api_url_org = 'https://crm.com/shorturl.php?id=6196f88b5619e1.63635494&workflow_id=56&record_id=';
$items = $order->get_items();
foreach ( $items as $item ) {
$product = $item->get_product();
$jk_sku = $product->get_meta('jk_sku');
if (!empty($jk_sku)) {
$api_url = $api_url_org.$jk_sku;
$response = wp_remote_get( $api_url );
}
}
}
Related categories: PHP WordPress Software Architecture MySQL WooCommerce