Magento 2 - Order Item changesHow to get invoice from order itemorder item cancel through apiRight magento observer for order paidHow to convert custom attribute from order item to invoice item?What's the best event/way to listen for all order state changes in Magento 2?Quote item price changesobserver event after order invoice status paid executed in magento 2How to check all order item already invoicedForce Order CompletionCancel order item without cancelling order in magento 2

Could the terminal length of components like resistors be reduced?

How to have a sharp product image?

What happens to Mjolnir (Thor's hammer) at the end of Endgame?

How could Tony Stark make this in Endgame?

Which big number is bigger?

What is the smallest unit of eos?

Is Diceware more secure than a long passphrase?

Coordinate my way to the name of the (video) game

Can I criticise the more senior developers around me for not writing clean code?

How to not starve gigantic beasts

How exactly does Hawking radiation decrease the mass of black holes?

Is there any official lore on the Far Realm?

a sore throat vs a strep throat vs strep throat

What happened to Captain America in Endgame?

Pulling the rope with one hand is as heavy as with two hands?

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

Is there really no use for MD5 anymore?

How to write a column outside the braces in a matrix?

Who was the lone kid in the line of people at the lake at the end of Avengers: Endgame?

Why did C use the -> operator instead of reusing the . operator?

Was there a shared-world project before "Thieves World"?

How can I practically buy stocks?

Two field separators (colon and space) in awk

Alignment of various blocks in tikz



Magento 2 - Order Item changes


How to get invoice from order itemorder item cancel through apiRight magento observer for order paidHow to convert custom attribute from order item to invoice item?What's the best event/way to listen for all order state changes in Magento 2?Quote item price changesobserver event after order invoice status paid executed in magento 2How to check all order item already invoicedForce Order CompletionCancel order item without cancelling order in magento 2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I want to inform customers with email all the details of their orders and I want to be able to show the difference. For example:



Those items shipped: ...
Those items cancelled: ...
Those items ...


credit memo, hold, invoice, ship, reorder, create returns... There so many situations. What should be the best way to achieve this?



Still I tried to use events for invoices (sales_order_invoice_save_after - sales_order_invoice_register):



public function execute(MagentoFrameworkEventObserver $observer)

$order = $observer->getEvent()->getOrder();
$stateProcessing = $order::STATE_PROCESSING;

$collection = $order->getItemsCollection();
foreach ($collection as $item)
$this->logger->info('item = '.$item->getName());
$this->logger->info(' qty_invoiced = '.$item->getData('qty_invoiced'));
$this->logger->info(' qty_invoicedorig = '.$item->getOrigData('qty_invoiced'));


return $this;



But quantities are the same, couldn't get the difference.










share|improve this question









New contributor




iskorum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Did you want only invoiced?

    – Kamlesh Solanki
    Apr 22 at 13:59











  • No, i want every actions. shipment, returns etc..

    – iskorum
    Apr 22 at 14:01











  • yes invoice and order item data are same if you try to create a partial credit memo for that then get it actually different in data.

    – Kamlesh Solanki
    Apr 22 at 14:07











  • Hmm I will try this. But what about shipments? Which event should I use for shipments

    – iskorum
    Apr 22 at 14:13











  • I have posted an answer please check it.

    – Kamlesh Solanki
    Apr 22 at 14:17

















0















I want to inform customers with email all the details of their orders and I want to be able to show the difference. For example:



Those items shipped: ...
Those items cancelled: ...
Those items ...


credit memo, hold, invoice, ship, reorder, create returns... There so many situations. What should be the best way to achieve this?



Still I tried to use events for invoices (sales_order_invoice_save_after - sales_order_invoice_register):



public function execute(MagentoFrameworkEventObserver $observer)

$order = $observer->getEvent()->getOrder();
$stateProcessing = $order::STATE_PROCESSING;

$collection = $order->getItemsCollection();
foreach ($collection as $item)
$this->logger->info('item = '.$item->getName());
$this->logger->info(' qty_invoiced = '.$item->getData('qty_invoiced'));
$this->logger->info(' qty_invoicedorig = '.$item->getOrigData('qty_invoiced'));


return $this;



But quantities are the same, couldn't get the difference.










share|improve this question









New contributor




iskorum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Did you want only invoiced?

    – Kamlesh Solanki
    Apr 22 at 13:59











  • No, i want every actions. shipment, returns etc..

    – iskorum
    Apr 22 at 14:01











  • yes invoice and order item data are same if you try to create a partial credit memo for that then get it actually different in data.

    – Kamlesh Solanki
    Apr 22 at 14:07











  • Hmm I will try this. But what about shipments? Which event should I use for shipments

    – iskorum
    Apr 22 at 14:13











  • I have posted an answer please check it.

    – Kamlesh Solanki
    Apr 22 at 14:17













0












0








0








I want to inform customers with email all the details of their orders and I want to be able to show the difference. For example:



Those items shipped: ...
Those items cancelled: ...
Those items ...


credit memo, hold, invoice, ship, reorder, create returns... There so many situations. What should be the best way to achieve this?



Still I tried to use events for invoices (sales_order_invoice_save_after - sales_order_invoice_register):



public function execute(MagentoFrameworkEventObserver $observer)

$order = $observer->getEvent()->getOrder();
$stateProcessing = $order::STATE_PROCESSING;

$collection = $order->getItemsCollection();
foreach ($collection as $item)
$this->logger->info('item = '.$item->getName());
$this->logger->info(' qty_invoiced = '.$item->getData('qty_invoiced'));
$this->logger->info(' qty_invoicedorig = '.$item->getOrigData('qty_invoiced'));


return $this;



But quantities are the same, couldn't get the difference.










share|improve this question









New contributor




iskorum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I want to inform customers with email all the details of their orders and I want to be able to show the difference. For example:



Those items shipped: ...
Those items cancelled: ...
Those items ...


credit memo, hold, invoice, ship, reorder, create returns... There so many situations. What should be the best way to achieve this?



Still I tried to use events for invoices (sales_order_invoice_save_after - sales_order_invoice_register):



public function execute(MagentoFrameworkEventObserver $observer)

$order = $observer->getEvent()->getOrder();
$stateProcessing = $order::STATE_PROCESSING;

$collection = $order->getItemsCollection();
foreach ($collection as $item)
$this->logger->info('item = '.$item->getName());
$this->logger->info(' qty_invoiced = '.$item->getData('qty_invoiced'));
$this->logger->info(' qty_invoicedorig = '.$item->getOrigData('qty_invoiced'));


return $this;



But quantities are the same, couldn't get the difference.







magento2 event-observer sales-order invoice






share|improve this question









New contributor




iskorum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




iskorum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Apr 22 at 14:02









ARUNPRABAKARAN M

601114




601114






New contributor




iskorum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 22 at 13:56









iskorumiskorum

1034




1034




New contributor




iskorum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





iskorum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






iskorum is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Did you want only invoiced?

    – Kamlesh Solanki
    Apr 22 at 13:59











  • No, i want every actions. shipment, returns etc..

    – iskorum
    Apr 22 at 14:01











  • yes invoice and order item data are same if you try to create a partial credit memo for that then get it actually different in data.

    – Kamlesh Solanki
    Apr 22 at 14:07











  • Hmm I will try this. But what about shipments? Which event should I use for shipments

    – iskorum
    Apr 22 at 14:13











  • I have posted an answer please check it.

    – Kamlesh Solanki
    Apr 22 at 14:17

















  • Did you want only invoiced?

    – Kamlesh Solanki
    Apr 22 at 13:59











  • No, i want every actions. shipment, returns etc..

    – iskorum
    Apr 22 at 14:01











  • yes invoice and order item data are same if you try to create a partial credit memo for that then get it actually different in data.

    – Kamlesh Solanki
    Apr 22 at 14:07











  • Hmm I will try this. But what about shipments? Which event should I use for shipments

    – iskorum
    Apr 22 at 14:13











  • I have posted an answer please check it.

    – Kamlesh Solanki
    Apr 22 at 14:17
















Did you want only invoiced?

– Kamlesh Solanki
Apr 22 at 13:59





Did you want only invoiced?

– Kamlesh Solanki
Apr 22 at 13:59













No, i want every actions. shipment, returns etc..

– iskorum
Apr 22 at 14:01





No, i want every actions. shipment, returns etc..

– iskorum
Apr 22 at 14:01













yes invoice and order item data are same if you try to create a partial credit memo for that then get it actually different in data.

– Kamlesh Solanki
Apr 22 at 14:07





yes invoice and order item data are same if you try to create a partial credit memo for that then get it actually different in data.

– Kamlesh Solanki
Apr 22 at 14:07













Hmm I will try this. But what about shipments? Which event should I use for shipments

– iskorum
Apr 22 at 14:13





Hmm I will try this. But what about shipments? Which event should I use for shipments

– iskorum
Apr 22 at 14:13













I have posted an answer please check it.

– Kamlesh Solanki
Apr 22 at 14:17





I have posted an answer please check it.

– Kamlesh Solanki
Apr 22 at 14:17










1 Answer
1






active

oldest

votes


















1














Below is the event list used to get the order collections data.



 - sales_order_save_after
- sales_order_invoice_save_after
- sales_order_shipment_save_after
- sales_order_creditmemo_save_after





share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    iskorum is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270975%2fmagento-2-order-item-changes%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Below is the event list used to get the order collections data.



     - sales_order_save_after
    - sales_order_invoice_save_after
    - sales_order_shipment_save_after
    - sales_order_creditmemo_save_after





    share|improve this answer



























      1














      Below is the event list used to get the order collections data.



       - sales_order_save_after
      - sales_order_invoice_save_after
      - sales_order_shipment_save_after
      - sales_order_creditmemo_save_after





      share|improve this answer

























        1












        1








        1







        Below is the event list used to get the order collections data.



         - sales_order_save_after
        - sales_order_invoice_save_after
        - sales_order_shipment_save_after
        - sales_order_creditmemo_save_after





        share|improve this answer













        Below is the event list used to get the order collections data.



         - sales_order_save_after
        - sales_order_invoice_save_after
        - sales_order_shipment_save_after
        - sales_order_creditmemo_save_after






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 22 at 14:17









        Kamlesh SolankiKamlesh Solanki

        24416




        24416




















            iskorum is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            iskorum is a new contributor. Be nice, and check out our Code of Conduct.












            iskorum is a new contributor. Be nice, and check out our Code of Conduct.











            iskorum is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270975%2fmagento-2-order-item-changes%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Bulk add to cart function issuecart vs. mini cart issue … rwd themeRedirect Add to cart button to cart pageAdd to cart issue - Magento 2.1The requested Payment Method is not available When creating an orderM2: reason add-to-cart might not function in production modeAdd to cart issue in some android devicesMagento 2 - custom price can not add to subtotal and grand total after add to cartAdd to cart codeIssue with my cart module on pdp and cart pages, just keeps spinningBulk price and quantity update using rest api

            БиармияSxpst500bh2ntaf! 3h2r