Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento 2 Order Collection + Customer Collection

I want to make a PHP file to get Orders and Customers from a Magento 2 based webshop (like exporting). I have a full code for Magento 1, but for M2 I have tried a lot of things.

I also needed this function for Products but now I have this.

If anybody can add a full code for Orders and Customers I would be glad, if I found one I will paste it.

like image 252
Harkály Gergő Avatar asked Nov 16 '25 11:11

Harkály Gergő


1 Answers

to get customer collection and there data you can use

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerObj = $objectManager->create('Magento\Customer\Model\Customer')->getCollection();
 foreach($customerObj as $customerObjdata ){
     print_r($customerObjdata ->getData());

     }
like image 57
Rohit Goel Avatar answered Nov 19 '25 02:11

Rohit Goel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!