0

Does anyone know how to sort order items before they are saved into DB? I mean after placing the order. Should I use the event sales_order_place_before?

1
  • Yeah, that should work. But while sorting you will have to be careful with bundle and config items. sales_order_item table does have parent_item_id. – Adarsh Khatri Mar 11 at 22:35
0

Magento not recommend the use of event Observer to edit data. It's better to use an after plugin (or a before plugin) method to sort your items before they are saved into database.

1
  • can you elaborate which class/method I should inject in plugin? – Pete Houston Mar 12 at 15:34

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.