Liquid, JavaScript, thema's
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.
Ontdek hoe je je activiteiten internationaal kunt uitbreiden met het leertraject en de ...
By Shopify Feb 7, 2025Breid uit naar de groothandel met het leertraject van Shopify Academy, B2B on Shopify: ...
By Shopify Jan 31, 2025Heb je ooit een klant aan de telefoon gehad die zich afvroeg waarom ze dubbele verzendk...
By Lee Sep 13, 2024