How to Check Product type is bundle by sku in magento 2?

You can check the Product type based on the SKU. If you have only product SKU and want to know about product type Bundle, you can know it easily.

First Load the Product repository by Product SKU, Call the getTypeId() method from the object and match it with Type class predefined product type constant.

Bundle product Constant defined as TYPE_BUNDLE = ‘bundle’. If your Product return type as a bundle it’s the bundle product otherwise product type is different.

<?php
namespace Jesadiya\Product\Model;

use Magento\Catalog\Model\Product\Type;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Catalog\Api\ProductRepositoryInterface;

class BundleType
{
    /**
     * @var ProductRepositoryInterface
     */
    private $productRepository;

    public function __construct(
        ProductRepositoryInterface $productRepository
    ) {
        $this->productRepository = $productRepository;
    }

    /**
    * Get Product Type bundle by SKU
    *
    * @param mixed
    * @return bool
    */
    public function isBundleProduct($sku)
    {
        $isTypeBundle = false;
        try {
            $product = $this->productRepository->get($sku);
            $isTypeBundle = $product->getTypeId() === Type::TYPE_BUNDLE;
        } catch (\Exception $exception) {
            throw new NoSuchEntityException(__('Product doesn\'t exist'));
        }
        return $isTypeBundle;
    }
}

Pass SKU of the product to check product type is bundle or not using Magento.

$sku = ’24-MB01′;
$product = $block->isBundleProduct($sku);

Output:
Boolean (True or false)