I’m trying to use the sales_order_place_after event to remove or add products to the order only after successful payment but facing a few different problems.
There are a few different solutions I could find, but every time I’m there is a different issue:
- Products I’m adding are not correctly deducted from the stock
- Cannot force that newly added product price is 0 when I’m adding more than one. Only the last one got 0.
- The new product must be listed separately on the order/invoice if this product already exists on the order.
I also need to remove some existing products from the order simultaneously and replace them with different ones at the same price.
As this will not affect the order total, so I think that order recalculation is unnecessary.
Unfortunately, I’m confused if I should still make those changes on the quote or already edit the order, so I would appreciate it if someone could tell me the correct way to do it, please?