Get order object inside email_order_set_template_vars_before event observerOrder email, how to get the product IdChange Order Confirmation Email For Specific OrdersHow to get cart item details in event observer?Can't get order object in sales_order_place_after observer methodIs it possible to have multiple sales email templates for one site?How to change the email template depending on shipping method?How to set custom value in default Email template Magento 2Which event observer will be triggered before customer mail send in Magento 2?Get Customer from Order inside Observer functionCustom email sent with template empty in observer after order

Way of refund if scammed?

Salesforce bug enabled "Modify All"

What does it mean when みたいな is at the end of a sentence?

Is a world with one country feeding everyone possible?

Are there historical examples of audiences drawn to a work that was "so bad it's good"?

How can I reduce the size of matrix?

Why is unzipped file smaller than zipped file

Can a UK national work as a paid shop assistant in the USA?

How to tease a romance without a cat and mouse chase?

Is there an idiom that means that you are in a very strong negotiation position in a negotiation?

Can diplomats be allowed on the flight deck of a commercial European airline?

Efficient Algorithms for Destroyed Document Reconstruction

Three knights or knaves, three different hair colors

How does the Earth's center produce heat?

Caught with my phone during an exam

Wifi light switch needs neutral wire. Why? AND Can that wire be a skinny one?

Adobe Illustrator: How can I change the profile of a dashed stroke?

Why is this integration method not valid?

What is this dime sized black bug with white on the segments near Loveland Colorodao?

Why did Nick Fury not hesitate in blowing up the plane he thought was carrying a nuke?

Why the work done is positive when bringing 2 opposite charges together?

mmap: effect of other processes writing to a file previously mapped read-only

What is the required burn to keep a satellite at a Lagrangian point?

Computing elements of a 1000 x 60 matrix exhausts RAM



Get order object inside email_order_set_template_vars_before event observer


Order email, how to get the product IdChange Order Confirmation Email For Specific OrdersHow to get cart item details in event observer?Can't get order object in sales_order_place_after observer methodIs it possible to have multiple sales email templates for one site?How to change the email template depending on shipping method?How to set custom value in default Email template Magento 2Which event observer will be triggered before customer mail send in Magento 2?Get Customer from Order inside Observer functionCustom email sent with template empty in observer after order






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








2















I have observer for email_order_set_template_vars_before where i am setting some email template variable to use in order confirmation email.



Now i want to find which products customer has ordered in that order and depending on that set value for email template variable.



So how can i access order object inside this observer method?










share|improve this question




























    2















    I have observer for email_order_set_template_vars_before where i am setting some email template variable to use in order confirmation email.



    Now i want to find which products customer has ordered in that order and depending on that set value for email template variable.



    So how can i access order object inside this observer method?










    share|improve this question
























      2












      2








      2








      I have observer for email_order_set_template_vars_before where i am setting some email template variable to use in order confirmation email.



      Now i want to find which products customer has ordered in that order and depending on that set value for email template variable.



      So how can i access order object inside this observer method?










      share|improve this question














      I have observer for email_order_set_template_vars_before where i am setting some email template variable to use in order confirmation email.



      Now i want to find which products customer has ordered in that order and depending on that set value for email template variable.



      So how can i access order object inside this observer method?







      magento2 event-observer email-templates






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 15 at 7:30









      KhushbuKhushbu

      13113




      13113




















          1 Answer
          1






          active

          oldest

          votes


















          0














          I found answer myself. Sharing here so it may help someone.



          We can get Order object inside execute method of observer as below:



          public function execute(MagentoFrameworkEventObserver $observer)


          $transport = $observer->getTransport();
          $order=$transport['order'];
          $orderId=$order->getEntityId(); /** We can call any method of $order as usual **/








          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
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f274649%2fget-order-object-inside-email-order-set-template-vars-before-event-observer%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









            0














            I found answer myself. Sharing here so it may help someone.



            We can get Order object inside execute method of observer as below:



            public function execute(MagentoFrameworkEventObserver $observer)


            $transport = $observer->getTransport();
            $order=$transport['order'];
            $orderId=$order->getEntityId(); /** We can call any method of $order as usual **/








            share|improve this answer



























              0














              I found answer myself. Sharing here so it may help someone.



              We can get Order object inside execute method of observer as below:



              public function execute(MagentoFrameworkEventObserver $observer)


              $transport = $observer->getTransport();
              $order=$transport['order'];
              $orderId=$order->getEntityId(); /** We can call any method of $order as usual **/








              share|improve this answer

























                0












                0








                0







                I found answer myself. Sharing here so it may help someone.



                We can get Order object inside execute method of observer as below:



                public function execute(MagentoFrameworkEventObserver $observer)


                $transport = $observer->getTransport();
                $order=$transport['order'];
                $orderId=$order->getEntityId(); /** We can call any method of $order as usual **/








                share|improve this answer













                I found answer myself. Sharing here so it may help someone.



                We can get Order object inside execute method of observer as below:



                public function execute(MagentoFrameworkEventObserver $observer)


                $transport = $observer->getTransport();
                $order=$transport['order'];
                $orderId=$order->getEntityId(); /** We can call any method of $order as usual **/









                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 15 at 8:19









                KhushbuKhushbu

                13113




                13113



























                    draft saved

                    draft discarded
















































                    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%2f274649%2fget-order-object-inside-email-order-set-template-vars-before-event-observer%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

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form