2

I'm trying to sell case quantities of our simple products for wholesale customers.

So. I create a bundle product, which is 12x of the simple product.

Customer buys the bundle product and inventory reduces the simple product by 12x. OK, good.

However, the customer returns the case of 12 and wants a refund.

I try to do a credit memo, but it only adds 1x of the simple product back into inventory, instead of 12x. I cannot change the qty on the credit memo page because it's the bundle product SKU.

Is this normal Magento behavior? Am I missing something?

Thanks, Dave

2

It's a bug in Magento (still not fixed as of Magento 1.9.2). Quoting from http://www.integer-net.com/2015/04/16/magento-bug-wrong-stock-when-refunding-bundles/:

The problem appears when you refund orders (using credit memos) which contain bundle products, and only if the bundle contains more than one simple product of the same type. In this case, all the products should be put back into the stock, but Magento will only return only one of each simple product.

If you have a look in the code at line 221 in Mage_Sales_Model_Service_Order it is hard coded to 1.

$qty = 1;

To change this behaviour, you have to overwrite the model replacing that line with the following code:

$parentItem = $orderItem->getParentItem();
if (is_object($parentItem) && $parentItem->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
    $qty = (float)$orderItem->getQtyOrdered() / (float)$parentItem->getQtyOrdered();
}
if(!isset($qty)) {
    $qty = 1;
}

Make sure to not edit the existing core file, but to make a rewrite instead.

The same replacement should be done in line 295 with the same code from above.

I also created a magento module which does this replacement for you. You can check it out at https://github.com/integer-net/IntegerNet_FixBundleCreditMemo.

4
  • Brilliant. What a find after an hour of head-scratching frustration. Thanks very much for this. – McNab Sep 15 '15 at 17:19
  • Just a comment on this module for future visitors and @fschmengler. If you have a user who has ordered multiple bundles and you need to do a credit memo for multiple bundles this won't work. For example they order 3 bundles (of 4 products each) and you need to create a credit memo for 2 bundles. For it to work the admin needs to create 2 separate credit memos of 1 bundle each. – McNab Sep 15 '15 at 18:30
  • 1
    Thanks for the feedback, I added it as issue in the GitHub repository, we'll see what we can do about it. – Fabian Schmengler Sep 15 '15 at 18:58
  • 2
    A suggested change by user @Joe was to multiply $qty with (float)$qtys[$orderItem->getParentItemId()]; - I did not verify it, but it should fix the incorrect child qty issue when more than 1 parent item is refunded. – Fabian Schmengler Jan 25 '19 at 7:33

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.