Hi,
In onCheckoutStepDisplay you can get the cart data with such code:
$cart = $view->checkoutHelper->getCart();
Once you have the $cart object, you can access the data of the products in it in $cart->products which is an array of product objects.
So, you want to loop on this array, get the product_id of each product and if the product_type of the product is equal to "variant", you want to use product_parent_id instead.
Then, you can use such code to load the id of the categories of a product:
$productClass = hikashop_get('class.product');
$categoryIds = $productClass->getCategories($product_id);
And then, if you need the data of the category, you can load it like this:
$categoryClass = hikashop_get('class.category');
$category = $categoryClass->get($category_id);