Search code examples
shopifyshopify-appshopify-api

Shopify API issue to retrieve cost of a list of product


I have a problem with the Shopify API, I would like to retrieve all the sales from a vendor, and then add up what all the products cost me for all the sales. The problem being that the "cost" of a product can only be recovered via the inventory API and therefore the time to recover all these costs is too long to then display that in my frontend. Is there another solution to my problem?


Solution

  • Just run a report in your store asking for the cost of goods sold. It is built in to Shopify. You can certainly do this per vendor. If not, I released an App nearly 10 years ago that does cost of goods sold per vendor reports. You're right that you are required to access the Inventory Item to get cost price, but that is not much work in an API call once you have the variant, as it is linked directly and using GraphQL you can have cost price and selling price and all discounts in the right currency using one API call.