Developer forum

Forum » Swift » Swift 1.22 & App 9.15.9

Swift 1.22 & App 9.15.9

Barry Geukdjian
Reply

Found a bug in the Swift (both in 1.20 & 1.22).

When you are in the product details and entering a product to cart (e.g. 10092 which has by default "4 in stock"), the quantity specified in the quantity box is added UNCONDITIONALLY to the cart.  To test this, go to product 10092 details and type 100 in the quantity box and then either hit Enter or click "Add to cart".  You will see that 100 items will be added to the cart even though the available stock is only 4.

Moreover, when you go to the cart summary, you will see that the quantity box correctly shows the maximum available quantity of 4 for item 10092 but the total amount for that line will be the quantity entered (e.g. 100 x 14.39 = 1439.00).  End result is that customer when checking out will end up paying for 100 units even though only 4 are registered in the cart.

The logic that checks the available quantity doesn't seem to be working.  You can check this yourself using https://swiftdemo.dynamicweb-cms.com demo website.

 

 


Replies

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Barry 

This is marked as bug #14664 

Sorry for any inconvenience this may have caused

Kind Regards
Dynamicweb Care Support
Kristian Kirkholt

 
Martin Ottesen
Martin Ottesen
Reply

Hi Kristian,

I can see that this kinda has been fixed in the new 1.23 release, but I think it might have been fixed the wrong way?

So instead of actually checking the available stock, it now still adds the number of products in the above example 100, instead of the 4 available... But instead of showing the 4 available in stock, it now shows the 100 in the quantity selector. I'm not quite sure this was the issue Barry was referring to.

I think the issue is that it's even possible to add 100 of this product when there are only 4 in stock when the product is not "Always in stock".

I would never want the user to be able to check out with 100 products when I only have 4 in storck, unless the "Always in stock" is checked off on the products.

Does this make sense? 

Kind Regards 
Martin

 
Barry Geukdjian
Reply

Hi Martin (and Kristian),

This is exactly the issue I was referring to which I also believe was fixed in the wrong way.  The bug we initially reported had to do with the fact that we could add more items in the cart than the available stock.  But this is not the main bug - after going in the cart summary (and say adding 100 items even though only 4 are available in stock), the cart summary page automatically was reducing (correctly in my opinion) the stock to the AVAILABLE STOCK of 4 BUT IT WAS FAILING TO ADJUST THE TOTAL AMOUNT.  In your example, you managed to add 100 items with a unit price of 14,39.  Prior to the fix, you would get Quantity 4 but still with a total of 1439,00 in the cart summary.

The Swift 1.23.0 fix basically now just removes the available stock quantity (4) and replaces it with the quantity requested by the customer (100) so the total now looks correct. However, we still only have 4 items in stock so how are we supposed to deliver the rest of the 96 items which are not available?

The correct fix for this would be to RECALCULATE the cart total when Swift (Version < 1.23.0) correctly was calculating the Quantity to the available maximum stock value (4 in this example) and change the cart total to 4 x 14,39 = 57,56 (instead of allowing the 100 units at a total price of 1439,00).

Regards,

Barry

 
Barry Geukdjian
Reply

Found a solution for this: If you set the product reservation (Settings > Ecommerce > Advanced configuration > Shopping cart) "Minutes the products in cart are reserved" to say 15 minutes and check the option "Reserve when the product is added to cart", the system will NOT allow you to add more than the current stock available and for the next 15 minutes, the product will be reserved for that user.

This basically won't allow the user to add a higher quantity in the cart than the available stock so the issue will be fixed (in terms of the cart total).  Also, in the cart summary page, if you increase the item's quantity, it does check for the available stock.

Regards,

Barry

 

You must be logged in to post in the forum