How to export all customers based on ordered items SKU?Export all guest customersI want to export all the...

Why doesn't the fusion process of the sun speed up?

Emojional cryptic crossword

pipe commands inside find -exec?

Exposing a company lying about themselves in a tightly knit industry: Is my career at risk on the long run?

Determine voltage drop over 10G resistors with cheap multimeter

Help with identifying unique aircraft over NE Pennsylvania

Nested Dynamic SOQL Query

Why do I have a large white artefact on the rendered image?

When did hardware antialiasing start being available?

Does convergence of polynomials imply that of its coefficients?

Was World War I a war of liberals against authoritarians?

Hackerrank All Women's Codesprint 2019: Name the Product

What is the tangent at a sharp point on a curve?

Isn't the word "experience" wrongly used in this context?

Weird lines in Microsoft Word

When should a starting writer get his own webpage?

Print last inputted byte

What are the rules for concealing thieves' tools (or items in general)?

Do I need an EFI partition for each 18.04 ubuntu I have on my HD?

Should a narrator ever describe things based on a characters view instead of fact?

Asserting that Atheism and Theism are both faith based positions

Why are there no stars visible in cislunar space?

Gauss brackets with double vertical lines

Output visual diagram of picture



How to export all customers based on ordered items SKU?


Export all guest customersI want to export all the customers who used a couponExport customers error “barkeloo payment”How to export from DB Sku - Order Number - Quantity Sold?Magento 1 retrieve customer email who ordered from specific categoryHow can I Get Sku In Products Ordered ReportsExclude one SKU from all price rulesGet all ordered products for all customersMAGENTO 2 Orders Grid Add SKU and Export to CSVExport customers list with IP address?













1















How to find all customers who ordered a certain SKU ?










share|improve this question





























    1















    How to find all customers who ordered a certain SKU ?










    share|improve this question



























      1












      1








      1








      How to find all customers who ordered a certain SKU ?










      share|improve this question
















      How to find all customers who ordered a certain SKU ?







      magento2.2 orders export sku






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 7 mins ago









      Teja Bhagavan Kollepara

      3,00641949




      3,00641949










      asked 10 hours ago









      DevAndDevAnd

      159218




      159218






















          2 Answers
          2






          active

          oldest

          votes


















          0














          The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



          select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
          from sales_order o
          join sales_order_item oi on o.entity_id = oi.order_id
          where oi.sku = '[YOUR SKU HERE]';





          share|improve this answer































            0














            Execute below script.



            <?php

            use MagentoFrameworkAppBootstrap;
            require 'app/bootstrap.php';
            $bootstrap = Bootstrap::create(BP,$_SERVER);

            $objectManager = $bootstrap->getObjectManager();
            $state = $objectManager->get('MagentoFrameworkAppState');
            $state->setAreaCode('frontend');

            $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
            $storeId = $storeManager->getStore()->getId();
            $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


            $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
            $connection = $resource->getConnection();
            $sku = '24-WB04';



            $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

            $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

            print_r($Itemcollection->getData());




            share























              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%2f266421%2fhow-to-export-all-customers-based-on-ordered-items-sku%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



              select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
              from sales_order o
              join sales_order_item oi on o.entity_id = oi.order_id
              where oi.sku = '[YOUR SKU HERE]';





              share|improve this answer




























                0














                The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



                select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
                from sales_order o
                join sales_order_item oi on o.entity_id = oi.order_id
                where oi.sku = '[YOUR SKU HERE]';





                share|improve this answer


























                  0












                  0








                  0







                  The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



                  select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
                  from sales_order o
                  join sales_order_item oi on o.entity_id = oi.order_id
                  where oi.sku = '[YOUR SKU HERE]';





                  share|improve this answer













                  The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



                  select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
                  from sales_order o
                  join sales_order_item oi on o.entity_id = oi.order_id
                  where oi.sku = '[YOUR SKU HERE]';






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 9 hours ago









                  HelgeBHelgeB

                  2,5781320




                  2,5781320

























                      0














                      Execute below script.



                      <?php

                      use MagentoFrameworkAppBootstrap;
                      require 'app/bootstrap.php';
                      $bootstrap = Bootstrap::create(BP,$_SERVER);

                      $objectManager = $bootstrap->getObjectManager();
                      $state = $objectManager->get('MagentoFrameworkAppState');
                      $state->setAreaCode('frontend');

                      $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
                      $storeId = $storeManager->getStore()->getId();
                      $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


                      $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
                      $connection = $resource->getConnection();
                      $sku = '24-WB04';



                      $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

                      $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

                      print_r($Itemcollection->getData());




                      share




























                        0














                        Execute below script.



                        <?php

                        use MagentoFrameworkAppBootstrap;
                        require 'app/bootstrap.php';
                        $bootstrap = Bootstrap::create(BP,$_SERVER);

                        $objectManager = $bootstrap->getObjectManager();
                        $state = $objectManager->get('MagentoFrameworkAppState');
                        $state->setAreaCode('frontend');

                        $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
                        $storeId = $storeManager->getStore()->getId();
                        $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


                        $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
                        $connection = $resource->getConnection();
                        $sku = '24-WB04';



                        $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

                        $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

                        print_r($Itemcollection->getData());




                        share


























                          0












                          0








                          0







                          Execute below script.



                          <?php

                          use MagentoFrameworkAppBootstrap;
                          require 'app/bootstrap.php';
                          $bootstrap = Bootstrap::create(BP,$_SERVER);

                          $objectManager = $bootstrap->getObjectManager();
                          $state = $objectManager->get('MagentoFrameworkAppState');
                          $state->setAreaCode('frontend');

                          $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
                          $storeId = $storeManager->getStore()->getId();
                          $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


                          $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
                          $connection = $resource->getConnection();
                          $sku = '24-WB04';



                          $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

                          $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

                          print_r($Itemcollection->getData());




                          share













                          Execute below script.



                          <?php

                          use MagentoFrameworkAppBootstrap;
                          require 'app/bootstrap.php';
                          $bootstrap = Bootstrap::create(BP,$_SERVER);

                          $objectManager = $bootstrap->getObjectManager();
                          $state = $objectManager->get('MagentoFrameworkAppState');
                          $state->setAreaCode('frontend');

                          $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
                          $storeId = $storeManager->getStore()->getId();
                          $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


                          $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
                          $connection = $resource->getConnection();
                          $sku = '24-WB04';



                          $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

                          $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

                          print_r($Itemcollection->getData());





                          share











                          share


                          share










                          answered 8 hours ago









                          Amitkumar solankiAmitkumar solanki

                          373113




                          373113






























                              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%2f266421%2fhow-to-export-all-customers-based-on-ordered-items-sku%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

                              “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                              How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                              夢乃愛華...