I am trying to read from thankyou.php orders and populate order_id, sku, price, quantity to a javascript snipper. The problem for me is how to \"catch\" the
UPDATED
As you are finding hard to locate functions.php file you can created a plugin. Create a PHP file as wh-thankyou-tracking.php under /wp-content/plugins/ and copy paste the below code to it and save it. And form admin panel Activate WH Order Tracking JS plugin
get_items();
$product_js = [];
foreach ($items as $item_id => $item_data)
{
//getting product object
$_product = wc_get_product($item_data['item_meta']['_product_id'][0]);
//getting all the product category
$pro_cat_array = wp_get_post_terms($_product->ID, 'product_cat');
$sku = $sku = $_product->get_sku();
$qty = $item_data['item_meta']['_qty'][0];
$pro_cat = implode(',', $pro_cat_array);
$pro_brand = $_product->get_attribute('pa_brand'); //replace it with your brand attribute slug
$pro_price = $item_data['item_meta']['_line_total'][0];
//storing all the line item as a string form
$product_js[] = '{id: "' . $sku . '",category:"' . $pro_cat . '",brand:"' . $pro_brand . '",price: "' . $pro_price . '"quantity:"' . $qty . '"}';
}
?>
Hope this helps!