Exclude minimum order amount for a specific category in Magento 2

For exclude the minimum order amount for specific category, please follow the below instructions:Exclude minimum order amount for a specific category in Magento 2

Go to this file path:
vendor/magento/module-quote/Model/Quote.php

And find this function validateMinimumAmount

After that, below this code:

$minOrderActive = $this->_scopeConfig->isSetFlag(
'sales/minimum_order/active',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$storeId
);

Add this code and add the category ID in condition from the minimum order amount you want to exclude:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart'); 
$itemsCollection = $cart->getQuote()->getItemsCollection();
$itemsVisible = $cart->getQuote()->getAllVisibleItems();
$items = $cart->getQuote()->getAllItems();
        
$iscategory = false;

foreach($items as $item) {
             
  $product = $objectManager->create('Magento\Catalog\Model\Product')->load($item->getProductId());
  $categories = $product->getCategoryIds();
        
  foreach($categories as $category){
         $cat = $objectManager->create('Magento\Catalog\Model\Category')->load($category);
         $catid = $cat->getId();
                if($catid == 153) {
                    $iscategory = true;
                }
  }
            
 }
 if($iscategory == true) {
     return true;
 }

Like this

Now, the minimum order will not work if the cart has this particular category of items.

Thanks

Exclude minimum order amount for a specific category in Magento 2expoundsofttechsolution