Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Can we export only Price and Inventory of all the SKUs from Shopify through API?

Solved

Can we export only Price and Inventory of all the SKUs from Shopify through API?

HalmenCS
Visitor
2 0 0

Can we export only Price and Inventory of all the SKUs from Shopify through API???

 

If yes please share the API call details or link for the same.

Accepted Solution (1)

francesco_gs
Shopify Partner
73 6 12

This is an accepted solution.

hi @HalmenCS 

you will definitely need the graphql API in order to do this, using the mutation "bulkOperationRunQuery"

the query to bulk-run is this

{
    productVariants{
        edges{
            node{
                id
                sku
                price
                inventoryQuantity
            }
        }
    }
}

 

to be passed as argument of the mutation so this way:

 

mutation {
    bulkOperationRunQuery(query: """{
    productVariants{
        edges{
            node{
                id
                sku
                price
                inventoryQuantity
            }
        }
    }
}""") {
        userErrors{
            field
            message
        }
        bulkOperation{
            id
            status
            url
        }
    }
}

 

 

after launching this mutation you will need to poll the bulk operations endpoint to get the status of the mutation launched: when completed, you'll receive a link for your JSONL file with all the data required, you can parse it the way you want, with a script or, since this query has only 1 node in output and so you will have only 1 line for each product, you could also easily convert the JSONL into a text/csv by doing some replaceAll with a text editor

 

btw here's the official doc

View solution in original post

Reply 1 (1)

francesco_gs
Shopify Partner
73 6 12

This is an accepted solution.

hi @HalmenCS 

you will definitely need the graphql API in order to do this, using the mutation "bulkOperationRunQuery"

the query to bulk-run is this

{
    productVariants{
        edges{
            node{
                id
                sku
                price
                inventoryQuantity
            }
        }
    }
}

 

to be passed as argument of the mutation so this way:

 

mutation {
    bulkOperationRunQuery(query: """{
    productVariants{
        edges{
            node{
                id
                sku
                price
                inventoryQuantity
            }
        }
    }
}""") {
        userErrors{
            field
            message
        }
        bulkOperation{
            id
            status
            url
        }
    }
}

 

 

after launching this mutation you will need to poll the bulk operations endpoint to get the status of the mutation launched: when completed, you'll receive a link for your JSONL file with all the data required, you can parse it the way you want, with a script or, since this query has only 1 node in output and so you will have only 1 line for each product, you could also easily convert the JSONL into a text/csv by doing some replaceAll with a text editor

 

btw here's the official doc