I made some modifications on my customer group_id and I have now multi-select, so I can select more than 1 groups per customer and I setup a new customer group with the name myshipping. How I can apply free shipping if the customer have myshipping group assigned?

Thank you

I found this maybe will help someone to give me an idea:


class Anshu_ShippingFilter_Model_Shipping extends Mage_Shipping_Model_Shipping {

    public function collectCarrierRates($carrierCode, $request) {
        if (!$this->_checkCarrierAvailability($carrierCode, $request)) {
            return $this;
        return parent::collectCarrierRates($carrierCode, $request);

    protected function _checkCarrierAvailability($carrierCode, $request = null) {
        $isLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
        if ($isLoggedIn) {

            $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
            if (2 == $groupId && 'freeshipping' == $carrierCode) {
                return false;
            return true;


1 Answer 1


You can use the Shopping Cart Price Rules which is available out-of-the box in Magento.

Use the following fields to achieve this:

  1. Under Rule Information tab => Customer Groups => Choose your desired group
  2. Under Actions tab => Set Free Shipping to Yes

Updated Answer

Since you have modified the default one group per customer workflow, Shopping cart rules have problems in identifying the proper customer group ID. Check the code in the following file:

Class name - Mage_SalesRule_Model_Validator

Method name - protected function _getRules()

As you can see in that method, the customer group ID is being treated as a single value. But in your modified workflow, it will have multiple values. So, you need to modify this class (not only this particular method but the whole class) to suit your needs.

  • I already do this but the problem is like this: when the customer is assigned to one of my groups, it works well, but if you try to assign him to 2 groups simultaneously, it doesn't work
    – Robert
    Dec 12, 2017 at 15:06
  • @Robert I have updated the answer Dec 12, 2017 at 15:16
  • okay, but I don;t understand very well, can you give me an example with working code?
    – Robert
    Dec 12, 2017 at 15:20
  • @Robert It depends on your current implementation, so I cannot give you a working code for this scenario. The hint here is that this method is being used in the processFreeShipping() method of the same class. Go through the core code and modify it according to your implementation. Dec 12, 2017 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.