1

I use sales_order_save_commit_after for same change to shipment and after this i save new subtotal and grand total, it's worked very well for COD but when i wanna use to another online payment the grand total that send to bank is last amount.

For example if the last amount is 500$ and new amount after my change is 800$ , 500$ sent to bank.

After many debug i found sales_order_save_commit_after observer run after payment.

My question is : which order place event was fire before payment and is more like sales_order_save_commit_after event ?

1

sales_order_save_commit_after runs after the order has been fully processed and saved to the database. If you are altering the order data, you want to do that before data has been saved. Moreover, if you are altering amounts, you want to do it before placement has occurred. Placement ($order->place()) is when payment is processed.

Try this event: sales_order_place_before

You can find it in \Magento\Sales\Model\Order.

If that won't work for your case, you'll need to give more details as to why.

| improve this answer | |
0

for each action's controller Magento 2 have one event . i use payment action for fixed my bug and it worked very well . Of course i know it is not good solution but it fixed my problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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