It is possible that the states of the order are updated with the states of the payments, since currently the payments that are made and remain in a rejected state, I get the discount in the same way of the inventory and I do not want that to happen.
Yes when you create the order the stock is decremented > Order status is Pending Make a payment > Order Status is Processing Ship / Deliver > Order status is Completed Cancel or refund Order > - Default process > Stock is not incremented as you do not know why the order was cancelled or refunded - you may not have received the stock back ? You need to manually adjust the stock after cancel or refund - There is a setting catalogsettings.publishbackproductwhencancellingorders set to True this will put items back into stock automatically
I need the product not discounted if the payment is not approved.
Is it about customer will not get discount untill he pays for that? If yes then this is not possible without customization. In nopCommerce, first it calculates price including discounts, then place order and finally process for payment.
I need that the inventory decrease is not made, that is, if a payment is rejected, I do not want it to make the product decrease, but currently, regardless of whether the payment is approved or rejected, the system always makes the inventory product decrease.
Out of the box, Inventory will reduce when the order is confirmed (placed); if the order is Cancelled then it should adjust then inventory. The exception is if you are using "multiple warehouses", in which case Inventory will update when the order is shipped.
To reduce when the order is paid will require customization.
Of course if you make this change what happens in the case of the last item in stock ? A customer purchases an item and is about to pay for it Another customer comes along and also purchases the last item They pay for the item and then the stock is decremented and the stock is now zero The first customer pays for the order and you try to decrement the stock but it’s already zero What do you want to do in the case ? Set stock to -1 or give the customer an automatic refund ?