1

We are looking to solve a problem with Magento 2.4.6 (version probably irrelevant). We have multiple configurable products available for sale and customers will place orders for big quantities of the various options. For example 500 Red / 400 Green / 300 Blue. Once they have been through and added all their items to a basket should there be only 450 Red available it means the customer is presented with the "Requested Qty not available" message. This means that they need to view each product manually and see which stock numbers have been changed.

Is there a way to decrement the number of items in the cart to the max stock available (if fewer than initially requested).

This would also be useful if the same rule could apply when adding to the cart from a page with multiple varients in case the stock numbers change as the user is filling out the values.

Thanks.

1 Answer 1

0

Custom Extension or Module: Develop a custom Magento module or extension that hooks into the cart addition and update processes. This module would check the available stock for each item as it's added to the cart or when the cart is updated.

Automatic Quantity Adjustment: If the requested quantity exceeds the available stock, the module would automatically adjust the quantity in the cart to the maximum available stock. This adjustment should be clearly communicated to the customer to avoid confusion.

Front-End Notifications: Implement user-friendly notifications on the front end. When a quantity adjustment occurs, display a message informing the customer of the change due to stock limitations.

Real-Time Stock Check: For the scenario where stock levels change as the user is adding items to the cart, implement a real-time stock check functionality. This would require AJAX calls to verify stock levels before the item is added to the cart.

Performance Considerations: Ensure that the solution is optimized for performance, as real-time stock checks and cart updates can be resource-intensive, especially for stores with high traffic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.