Whats the best way to set a minimum subtotal for customer group? Is this even possible in native Magento?
2 Answers
it is possible but you need some customization.
Magento check the min Order amount
from validateMinimumAmount
function of checkout address object means Sales quote addess object (class Mage_Sales_Model_Quote_Address
). You can rewrite the class and override the method
You need fetch quote Customer group and put minimum amount according to customer group.
and logic should be like that
class Your_Module_Model_Quote_Address extends Mage_Sales_Model_Quote_Address
{
public function validateMinimumAmount()
{
$result = parent::validateMinimumAmount();
if (!$result) {
return false;
}
$customergroupId=$this->getQuote()->getCustomerGroupId();
$CustomGroupMinprice=array(1=>100,2=>500,3=>200);
if(!is_null($customergroupId) && array_key_exists($customergroupId,$CustomGroupMinprice)){
foreach($CustomGroupMinprice as $key=>$value):
if($customergroupId==$key && $this->getBaseSubtotalWithDiscount() < $value):
return false;
break;
endif;
endforeach;
}elseif($this->getBaseSubtotalWithDiscount() < $amount) {
return false;
}
return true;
}
}
in $CustomGroupMinprice=array(1=>100,2=>500,3=>200)
, 1,2,3
mean customer group id
and 100,300,200 its respective minimum amount
For my opinion, using an extension is the simplest way to set up minimum order subtotal for customer group.
Magento default only supports setting minimum order amount, bu not for specific customer group.
You can read about this extension to limit order amount that each customer group has to meet