How to get option type by option id in bundle product programmatically Magento 2?

You can retrieve the option type by option id of the bundle product Magento 2. There is four option type available for the bundle product like Checkbox, radio, drop-down and Multiple select.

You can check the given option type by its id using programmatically from the catalog_product_bundle_option table. A table used to store option id, type, parent_id, required and position field.

You need to instantiate Option Collection to fetch type details,

namespace Jesadiya\OptionType\Model;

use Magento\Bundle\Model\ResourceModel\Option\CollectionFactory;

class BundleOptionType
     * @var CollectionFactory
    private $optionCollection;

    public function __construct(
        CollectionFactory $optionCollection
    ) {
        $this->optionCollection = $optionCollection;

     * get option type
     * @param int $optionId
     * @return string
    public function getOptionTypeById(int $optionId)
        $optionCollection = $this->optionCollection->create();
        $optionCollection->addFieldToFilter('option_id', ['eq'=>$optionId])->getFirstItem();
        $type = '';
        foreach ($optionCollection as $option) {
            $type = $option->getType();
        return $type;

Call from the template or any PHP class,

$optionId = 1;
echo $optionType = $this->getOptionTypeById($optionId);

The output will be based on option id, radio, select, checkbox, multi-select.