Product Sale Count

Solved

Product Sale Count

engkiwi
Tourist
4 0 1

How can I get the number of purchases of a product or its variant?

 

For example, for the displaying something like "100 people have purchased this product".

 

Thank you!

Accepted Solution (1)

Shayne
Shopify Staff (Retired)
254 20 48

This is an accepted solution.

If you only want to display it to the merchant, you have a few options. If it's a Plus store, your best option is using ShopifyQL.

 

If you want it to be available on more plan types, you're better off fetching a bunch of orders from the API and then aggregating them based on the products sold.

If you want to show this on the storefront, it's a little more tricky. Your best bet would be pushing the "recently sold" data into a metafield on the product, and then referencing that metafield from the theme.

Shayne | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Reply 1 (1)

Shayne
Shopify Staff (Retired)
254 20 48

This is an accepted solution.

If you only want to display it to the merchant, you have a few options. If it's a Plus store, your best option is using ShopifyQL.

 

If you want it to be available on more plan types, you're better off fetching a bunch of orders from the API and then aggregating them based on the products sold.

If you want to show this on the storefront, it's a little more tricky. Your best bet would be pushing the "recently sold" data into a metafield on the product, and then referencing that metafield from the theme.

Shayne | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog