Developer forum

Forum » Feature requests » Information about products not in stock

Information about products not in stock

Anders Ebdrup
Reply

Hi Dynamicweb,

 

I am missing out a feature telling me if a product cannot be added to the cart due to low stock levels.

 

Right now the function just returns nothing and do not tell the reason for not adding the product to the cart.

            ' Check stock and reserve
            If ProductReserve.Enabled AndAlso ProductToPutInCart.Type <> ProductType.Service AndAlso ol.HasType({OrderLine.OrderLineType.Product, OrderLine.OrderLineType.PointProduct}) Then

                Dim cartStock As Double = ProductReserve.GetReservedAmount(ol.ProductID, ol.ProductVariantID) + QuantityOrderLine
                If ProductReserve.GetReserveMode = ProductReserve.ReserveMode.modeCheckout Then
                    ' When products is reserved only in checkout step we should take into account is there such product exist in cart
                    cartStock += EcomCart.OrderLines.Where(Function(cartLine) cartLine.ProductID = ProductID AndAlso cartLine.ProductVariantID = VariantID).Select(Function(cartLine) cartLine.Quantity).FirstOrDefault()
                End If

                If ProductToPutInCart.UnitStock < cartStock Then
                    Return Nothing
                End If
            End If

 

I hope to see this implemented in the standard solution soon, or at least adding a notification for being able to overrule and add information to the template.
The information to the template should include the current stock level so this can be shown to the customer.

 

Best regards,

Anders


Replies

 
Anders Ebdrup
Reply

Hi Dyanmicweb,

 

When will this be possible as we have several clients pushing for this information?

 

Best regards, Anders

 
Nicolai Høeg Pedersen Dynamicweb Employee
Nicolai Høeg Pedersen
Reply

Hi Anders

TFS#19569 giving you a notification added to the current sprint ending Tuesday.

BR Nicolai

 
Anders Ebdrup
Anders Ebdrup
Reply

Dear Nicolai,

 

I have found this old thread, but cannot locate the TFS-number. How can we achieve this feature?

 

Best regards, Anders

 
Vincent Gercke Pedersen
Reply

+1

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Reopened as TFS#87703 - just implemented a Notifications.Ecommerce.Cart.Line.NotAdded notification that is fired if the product cannot be added for some reason.

The notification will have a reference to the order (cart), the product and a reason why it failed. Reasons are currently these:

  • NotInStock
  • NotEnoughPoints
  • NotEnoughQuantitySpecified
  • ProductDiscontinued

It is merged to 9.9 and is awaiting code review and to pass QA.

BR Nicolai

Votes for this answer: 1
 
Anders Ebdrup
Anders Ebdrup
Reply

NICE!!! wink

 

You must be logged in to post in the forum