cancel
Showing results for 
Search instead for 
Did you mean: 

Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

Problem:

If a product that has stock qty is added in cart and a customer changes the qty to a number more that the available stock price gets deducted on page update POST request and on every reload.

 

Steps to reproduce:

1. Disable product backorders (if enabled)

2. Add Stock qty into a product

3. Add product to cart

4. Change product cart qty to something above the available qty

5. Along the error message "The requested quantity for "%s" is not available." the unit price gets deducted.

6. Reload the page and unit price is deducted again.

 

Affected Version: 1.9.3.1 CE

 

8 REPLIES 8

Re: Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

@the_v did you ever find out how this can be fixed? I'm experiencing the exact same problem in 1.9.3.1

Re: Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

@the_v did you ever find out how this can be fixed? I'm experiencing the exact same problem in 1.9.3.1

Re: Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

Hi,

I've same problem on all my magento website with 1.9.3.2 and 1.9.3.1, but not in 1.9.2.4.
Someone found a solution? Thanks.

Re: Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

BUMP

I'm having the same problem on a site upgraded to 1.9.3.1

Re: Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

If you guys still need it, here is a patch that works, might need some tweaking to be perfect but it fixes the problem.

This is the patch file and it's contents:

cat ~/Downloads/Patch_FixQuoteItemRowTotalWhenOutOfStock.patch
--- app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal-org.php	2017-03-15 10:56:02.000000000 +0000
+++ app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php	2017-03-15 10:53:47.000000000 +0000
@@ -110,16 +110,17 @@
             );
             $item->setPrice($finalPrice)
                 ->setBaseOriginalPrice($finalPrice);
-            $item->calcRowTotal();
+//            $item->calcRowTotal();
         } else if (!$quoteItem->getParentItem() && !$item->getHasError()) {
             $finalPrice = $product->getFinalPrice($quoteItem->getQty());
             $item->setPrice($finalPrice)
                 ->setBaseOriginalPrice($finalPrice);
-            $item->calcRowTotal();
+//            $item->calcRowTotal();
             $this->_addAmount($item->getRowTotal());
             $this->_addBaseAmount($item->getBaseRowTotal());
             $address->setTotalQty($address->getTotalQty() + $item->getQty());
         }
+        $item->calcRowTotal();

         return true;
     }



Re: Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

Removing following from the Mage_Sales_Model_Quote_Address_Total_Subtotal _initItem() method solved it for me:

&& !$item->getHasError()

Because we do want to show prices when there's an error, we just don't want them to buy when error.

Re: Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

tommyq answer worked also for me. Good job!

 

After inspecting a bit more, I found that the problem was that I didn't set attribute "is_in_stock" when importing products (i thought I didn't need it because "manage_stock" was set to "No").

 

That was the cause for get "getHasError()" returning true.

Re: Cart price gets deducted on page reload when product qty is more than stock (Magento 1.9.3.1)

This is still happening in 1.9.3.9. tommyq is right, sadly i had to find the solution on my own. Needed a terrible debugging session. Found this thread after googling for 

!$item->getHasError(

Remove this and your good to go.