How do I get the Commerce order type programmatically? I have two Commerce order types, order_a and order_b, which I created at /admin/commerce/config/order-types.

I'm using Commerce 2 on Drupal 8.

I want to process them differently in hook_commerce_order_presave().

How can I programmatically get the order type?  When I check the entity type, it only has commerce_order, but I want to know what type of commerce order it is.  I can't find a method to get the order type specifically.

Here's the code I am using:

function MYMODULE_commerce_order_presave(\Drupal\commerce_order\Entity\OrderInterface $entity) {
  if ($entity-&gt;isNew()) {
    kint($entity-&gt;getEntityTypeId());
    die();
The order type is the bundle so you can use EntityInterface::bundle() to get that info:

$type = $entity-&gt;bundle();