Skip to content

Get fulfilled orders #316

Description

@kahmra

! 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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions