How to get product ID and variant ID with bulk editor

Tourist
9 1 0

I am trying to get the ID of the products and variant to create a mini excel spreadsheet.  Is there anyway to grab these products IDs from the bulk editor?  How do I do it? 

0 Likes
Shopify Partner
282 1 25

Hi, Charles!

I am not sure if you are open to an app suggestion, but if you are - use the Excelify app to export your products and variants data to Excel - that will include also ID and Variant ID fields.

https://apps.shopify.com/excel-export-import

Maris
Excelify.io

Excelify.io | Bulk Import Export Update Migrate | https://excelify.io
0 Likes
Highlighted
New Member
4 0 0

You can use shopify product id to read json and get product is and sku using below code : 

<?php 
 
ini_set('max_execution_time', 0); // for infinite time of execution 
 
for($i= 1 ;$i<26; $i++){
$pageurl = 'https://apikey:password@your-store.myshopify.com/admin/products.json?limit=250&page='.$i;
$data = json_decode(file_get_contents( $pageurl),true);
if(!empty($data['products'])){
foreach($data['products'] as $product){
$csv_data[] =array(
'Product ID '=>$product['id'],
'Sku'=>$product['variants'][0]['sku']
);
}
}
 }
if(!empty($csv_data)){
outputCsv('get-products-id.csv', $csv_data);
}
 
function outputCsv($fileName, $assocDataArray)
{
    ob_clean();
    header('Pragma: public');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Cache-Control: private', false);
    header('Content-Type: text/csv');
    header('Content-Disposition: attachment;filename=' . $fileName);    
    if(isset($assocDataArray['0'])){
        $fp = fopen('php://output', 'w');
        fputcsv($fp, array_keys($assocDataArray['0']));
        foreach($assocDataArray AS $values){
            fputcsv($fp, $values);
        }
        fclose($fp);
    }
    ob_flush();
}  
?>

 

0 Likes
New Member
2 0 0

I am thinking to get around this issue as well. Basically, all I want is to include the product id and variant id of the products from the regular Shopify product export feature. And we are not going to use Excelify so that means I have to depend on the Shopify product export. It looks like a very straightforward request that Shopify product export should already have. Is there any free app that can include the product id and variant or maybe some other way within Shopify itself?

0 Likes
New Member
2 0 3

I just used EZ Exporter under the 7-day trial & it pulls down the 2 columns you mentioned in under 5 minutes for 210 products.  Mine is just a quick fix, but it fits the bill.  Has integration options if this is useful to you.  Cheers, M

 


@ntiwari1309 wrote:

I am thinking to get around this issue as well. Basically, all I want is to include the product id and variant id of the products from the regular Shopify product export feature. And we are not going to use Excelify so that means I have to depend on the Shopify product export. It looks like a very straightforward request that Shopify product export should already have. Is there any free app that can include the product id and variant or maybe some other way within Shopify itself?


 

https://apps.shopify.com/ez-exporter?utm_campaign=installed&utm_content=contextual&utm_medium=shopif...

1 Like