I'm getting product object with a view. How to get its type?
$view = Views::getView('get_all_products');
$view->execute();
foreach ($view->result as $row) { // products
$product = $row->_entity;
$product = \Drupal::service('entity.repository')->getTranslationFromContext($product); // Translating it
$productType = $product-> ????
...
I think it better solution:
$product_type = $product->bundle();