add_action('woocommerce_order_note_added', function($comment_id, $comment) { if (empty($comment->comment_post_ID)) return; $order = wc_get_order($comment->comment_post_ID); if (!$order) return; if (stripos($comment->comment_content, 'Payment confirmed via Site B callback') === false) return; if ($order->has_status(['processing'])) { $order->update_status('completed', 'Auto-completed after Site B callback.'); } }, 10, 2);