Get fulfilled orders
kahmra opened this issue · 4 comments
kahmra commented
! I'm trying to get all the fulfilled orders, for that I created this function:
public function getOrders($status = null, $financialStatus = null, $since = null, $limit = 250)
{
$shopify = $this->connectToShopify();
if ($shopify) {
$options['limit'] = $limit;
if ($status !== null) {
$options['status'] = $status;
}
if ($financialStatus !== null) {
$options['financial_status'] = $financialStatus;
}
if ($since !== null) {
$options['since_id'] = $since;
}
return $shopify->Order->get($options);
} else {
return [];
}
}
If I pass 'closed' to the status variable, it retrieves both canceled and fulfilled orders, but I need only the shipped orders. For that, I created this second function:
public function getFulfilledOrders($status, $since = null, $limit = 250)
{
$shopify = $this->connectToShopify();
if ($shopify) {
if ($status !== null) {
$options['fulfillment_status'] = 'fulfilled';
}
return $shopify->Order->get($options);
} else {
return [];
}
}
However, this function returns an empty array
Array ()
despite having more than 1000. What could be my mistake? Thank you!
aogg2023 commented
I have reviewed your question and have not used it before. I am currently unable to answer you,
Do you know the answer to my question?
How to obtain all orders for a store with over 250 orders? Currently, I can only obtain 250 orders
kahmra commented
Currently
$fulfilledOrders = $ShopifyConnection->fulfilledOrders($sinceId,250);
foreach ($fulfilledOrders as $order) {
$shopifyBatchProcessData->batchProcess("Orders",$order,"order");
}
aogg2023 commented
现在
$fulfilledOrders = $ShopifyConnection->fulfilledOrders($sinceId,250); foreach ($fulfilledOrders as $order) { $shopifyBatchProcessData->batchProcess("Orders",$order,"order"); }
Thank you.