Hello, I created a Shopify App and I'm trying to get list of orders from my Shopify Store using Orders Shopify API. I am using Laravel. I'm new in this framework and so far I am only able to get products by using the same function.
Please, I flipped up and down the internet and I get nothing. I would like someone helps to solve this. If is there an suggestion also how to sync orders to a database it will be great. Thanks
$array = array();
$shop = Auth::user();
$orders = $shop->api()->rest('GET',"/admin/api/2021-04/orders.json", $array);
$orders = json_decode($orders['response']->getBody(), JSON_PRETTY_PRINT);
To get Shopify orders you can use this docs: https://shopify.dev/docs/admin-api/rest/reference/orders/order
Note: As of June 6th, 2018, only the last 60 days' worth of orders from a store will be accessible from the Order resource by default. If you want to access older orders, then you need to request access to all orders. If your app is granted access, then you can add the read_all_orders scope to your app along with read_orders or write_orders. Private apps are not affected by this change and are automatically granted the scope.
For private apps, there is no need for additional scopes like the one with "all orders". You can get like this.
$orders = $shop->api()->rest('GET', '/admin/orders.json', array('status' => 'any', 'created_at_min' => "1900-01-01"));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.