<?php
   function unipixel_get_common_woo_data_purchase($order_id) { if (! class_exists("\x57\x6F\x6F\x43\x6F\x6D\x6D\x65\x72\x63\x65")) { return; } $order = wc_get_order($order_id); if (!$order) { return null;  }  $plcehldr_event_id = 'purchase_' . microtime(true);  $amData = unipixel_get_advanced_matching_data($order);  $plcehldr_lineItems = []; foreach ($order->get_items() as $item_id => $item) { $product = $item->get_product(); if (!$product) { continue; }  $subtotal = (float) $item->get_subtotal(); $total = (float) $item->get_total(); $discount = max(0, $subtotal - $total);  $arrCategories = unipixel_get_product_categories($product);  $variant = unipixel_get_product_variant($product); $plcehldr_lineItems[] = [ 'plcehldr_itemId' => $product->get_id(), 'plcehldr_itemName' => sanitize_text_field($product->get_name()), 'plcehldr_quantity' => (int)$item->get_quantity(), 'plcehldr_price' => (float)$item->get_total(), 'plcehldr_discount' => $discount, 'plcehldr_categories' => $arrCategories,  'plcehldr_variant' => $variant, ]; } return array_merge($amData, [  'plcehldr_eventId' => $plcehldr_event_id,  'plcehldr_clientIp' => sanitize_text_field(unipixel_get_ip_address() ?? ""), 'plcehldr_userAgent' => sanitize_text_field($_SERVER["\x48\x54\x54\x50\x5F\x55\x53\x45\x52\x5F\x41\x47\x45\x4E\x54"] ?? ""), 'plcehldr_fbpCookie' => sanitize_text_field($_COOKIE["\x5F\x66\x62\x70"] ?? ""),  'plcehldr_currency' => $order->get_currency(), 'plcehldr_value' => (float)$order->get_total(), 'plcehldr_transactionId' => (string)$order_id, 'plcehldr_tax' => (float)$order->get_total_tax(), 'plcehldr_shipping' => (float)$order->get_shipping_total(), 'plcehldr_lineItems' => $plcehldr_lineItems, ]); } 