Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • J 446 posts 863 karma points
    15 days ago
    J
    0

    Umbraco Commerce (Maybe Vendr) set error page on error

    I have my store setup and all works up until this point. I need to ensure the products haven't run out at the last step of the checkout. For this im using Zero Value as my Payment Method and clicking the I accept the terms then Continue to process payment.

    I have installed Umbraco commerce checkout with Umbraco Commerce (latest versions).

    I can make a successful order. I introduced the stock property for my store items and list the stock value in here.

    On the final step of the checkout i override the below method with some custom checks

    public override void Handle(OrderTransactionUpdatingNotification evt)
    

    Check to see if its the last step. If it is i check the stock value and if its 0 i would like to throw an error and handle it accordingly.

    At the moment i set the

    evt.Order.SetOrderStatus
    

    or

    evt.Order.Finalize
    

    to OrderStstusCode.ErrorAtPaymentGateway/ PaymentStatus.Error to indicate theres an error due to no stock.

    Even though i can see the error of 0 items and these lines of code hitting the application finishes what its doing in this Handle method and returns me to the homepage.

    If i remove the above lines where i set the status then the order is returned to the continue page but the status of the order is 'Ok' where i need to mark it as something other as there are no items.

    Ive set the Checkout Back Page but made no difference. Although im asking this question elsewhere too it would be nice if anyone could advise if im missing a setting or doing this wrong?

    I just cant get the user to the error page when querying the stock under the Handle method

Please Sign in or register to post replies

Write your reply to:

Draft