Product API Issue - Product Sync

Highlighted
Shopify Partner
20 0 0
Hi There!
 
We recently encountered some issues from existing users of our Shopify inventory sync app, where the actual number of store products does not match the total number of products synced to our platform.
 

The Shopify store: https://aditya-1984.myshopify.com/ for example has 1004 products, however, we are seeing only 930 products synced to our platform.

 

Screenshot 2020-03-10 at 10.37.46 AM.png

 

The code that we are using is below:

 

$keepGoing = true;
$sinceId = null;
$config['limit'] = 250;

do {
if (!is_null($sinceId)) {
$config['since_id'] = $sinceId;
}

// 'https://{myshopify-domain}/admin/api/2020-01/products.json'
$response = $shopify->products($config);

if (count($response['products']) < $config['limit']) {
$keepGoing = false;
}

foreach ($response['products'] as $product) {
$sinceId = $product['id'];

$products->add($product);
}
} while ($keepGoing);

 

 

The below api is giving us the correct number of products which is 1004, but this does not match the number of products actually synced to our platform.

 

// 'https://{myshopify-domain}/admin/api/2020-01/products/count.json'

 

Hoping someone from Shopify can assist us with this!

 

Best,

Aditya

0 Likes
Highlighted
Shopify Partner
20 0 0

Hi guys,

 

can anyone help us with this?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1040 139 163

Hey @HitPay,

 

I can't comment on the code, but I can confirm I'm able to access 1004 products through the API.


Are you using the next/prev pagination links in the header? Have you tried using a PHP library like this one?

0 Likes