>How to refund for bundle product without receiving product back

How to refund for bundle product without receiving product back

In Magento, there are 6 kinds of products including simple products, configurable products, grouped products, virtual products, downloadable products and bundle products. Sometimes, admins want to refund money for customers in case there are some problems with products, but with some kinds of products, they can not do that, especially with bundle products.

It may occur that admins want to refund amount of money for the buyers but they don’t want to get their products back.

This error appears when the product is bundle product and has not been set up price which you can see here:

 

Refund bundle products

– You can go to bundle products’ invoice, then you Click “Credit Memo” on the top of page. A table like this following one will appear:

Refund bundle products

 

– You should Change all quantity by number 0 and click “update” button.

– After that, change adjustment refund in case that there is no shipping, then click refund 

 

Refund bundle products

 

When you finish, the system will inform you the error that amount of refund money exceed the total of money and cant not  be refunded. 

Refund bundle products

However, don’t worry because you can fix this problem by this way: 

First, you rewrite model “Mage_Sales_Model_Service_Order”

Create a file like: app/code/local/NameSpace/YourModule/etc/config.xml

Declare:

<global>

          <models>

                   <yourmodule>

                             <class>NameSpace_YourModule_Model</class>

                   </yourmodule>

                   <sales>

                             <rewrite>

                                       <service_order>NameSpace_YourModule_Model_Sales_Service_Order</service_order>

                             </rewrite>

                             </sales>

          </models>

</global>

Second, create this file:

app/code/local/NameSpace/YourModule/Model/Service/Order.php

Rewrite:   function _canRefundItem();

class NameSpace_YourModule_Model_Sales_Service_Order extends Mage_Sales_Model_Service_Order

{

          protected function _canRefundItem($item, $qtys=array(), $invoiceQtysRefundLimits=array())

    {

        $this->updateLocaleNumbers($qtys);

        if ($item->isDummy()) {

            if ($item->getHasChildren()) {

                   $product=Mage::getModel('catalog/product')->load($item->getSku());

                   $productType = $product->getResource()->getTypeId();

                foreach ($item->getChildrenItems() as $child) {

                    if (empty($qtys)) {

                        if ($this->_canRefundNoDummyItem($child, $invoiceQtysRefundLimits)) {

                            return true;

                        }

                    } else if($productType == 4){

                        if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] >= 0) {

                            return true;

                        }

                    } else {

                             if (isset($qtys[$child->getId()]) && $qtys[$child->getId()] > 0) {

                            return true;

                        }

                    }

                }

                return false;

            } else if($item->getParentItem()) {

                $parent = $item->getParentItem();

                if (empty($qtys)) {

                    return $this->_canRefundNoDummyItem($parent, $invoiceQtysRefundLimits);

                } else {

                    return isset($qtys[$parent->getId()]) && $qtys[$parent->getId()] > 0;

                }

            }

        } else {

            return $this->_canRefundNoDummyItem($item, $invoiceQtysRefundLimits);

        }

    }

}

After that, you finish fixing this error. So you can easily refund money for customers and not get your products back. Hope that this instruction will be useful for you.
If you get any problem when trying to fix this error, you can contact us via our email: support@bsscommerce.com or Skype: support.bsscommerce

 

< Previous Post
Next Post >