How to display Customer Group Name
You can utilise the Customer Group Specific settings to achieve this directly from the Magento admin:
Alternatively in your theme's copy of the template file you want to adjust add the below code
<br/>Customer Group Id: <?= $order->getCustomerGroupId() ?> <?php if ($order->getCustomerIsGuest()): ?> <br/>GUEST ORDER <?php else: ?> <!-- Alternatively move this into a viewModel --> <br/>Customer Id: <?= $order->getCustomerId()?> <?php $groupRepo = \Magento\Framework\App\ObjectManager::getInstance()->get('\Magento\Customer\Api\GroupRepositoryInterface'); ?> <?php $group = $groupRepo->getById($order->getCustomerGroupId()) ?> <br/>Group Name: <?= $group->getCode()?> <?php endif; ?>