Variable $order in thankyou.php will be created by order key from URL. e.g. key=wc_order_593a3d1583f2e
So, it’s important to make sure return URLs of payment gateways include this param or thank you page won’t display order info and purchase event of Facebook pixel will not work neither.
$aio->Send['ClientBackURL'] = home_url('checkout/order-received/' . $order->id . '/?key=' . $order->order_key);
- How to get order key: