Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We use the Storefront API to get the products on our Shopify environment to render it on our headless website and we wish to render the discount value on the website itself. For example, if a product is 20% off, we wish to show "20% off" and a decreased price to our customers to make it clear there is a sale going on.
The problem is, when we get the product data from the Storefront API, it doesn't show any field which resembles any relation to an active sale. To tackle this issue, we thought about writing a query on the Admin API (as Discounts are not readable from the Storefront API) to get all active sales and then map those values to our products. For this we wrote the query below. 2 issues rise here; firstly the query to filter the status to only ACTIVE doesn't work. The other issue is that it demands a lot of points to get the sales that are going on, while a sale which involves more than 10 products won't even show all products.
{ automaticDiscountNodes(first: 10, query: "status:ACTIVE") { nodes { automaticDiscount { __typename ... on DiscountAutomaticBasic { status customerGets { items { __typename ... on DiscountCollections { collections(first: 10) { nodes { id } } } ... on DiscountProducts { products(first: 10) { nodes { id } } } } } } } } } }
Therefor my question exists in 2 parts.
Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025