Search code examples
magento

first time customer free shipping on your first order


My Question: How to logical and programmatic develop for this requirement. My requirement that : I need free shipping on customer first order. I have not any used coupon code or discount. I have directly set free shipping when customer sign up and place order.


Solution

  • I have create one custom shipping methods then add my custom code for above requirment.

    Shipping methods URL: following this url

    http://inchoo.net/magento/custom-shipping-method-in-magento/

    then added my code in carrier.php file like below.

    $session = Mage::getSingleton('customer/session');

     if ($session->isLoggedIn()) {
    
                $customer = Mage::getSingleton('customer/session')->getCustomer();
                //echo '<pre>';
                //print_r(get_class_methods($customer));
                $orders = Mage::getResourceModel('sales/order_collection')
                        ->addFieldToSelect('*')
                        ->addFieldToFilter('customer_id', $customer->getId());
    
                if (!$orders->getSize())
                { 
                    $result->append($this->_getFreeRate());
                    return $result;
                }
    
    
            }else{
    
                if ($expressAvailable) {
                $result->append($this->_getExpressRate());
                }
                $result->append($this->_getStandardRate());
                return $result;
                }