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.
Gebruiker | RANKING |
---|---|
2 | |
1 | |
1 | |
1 |
Op onze Shopify App Store kan je vele handige apps vinden die je kunnen helpen bij het opb...
By Arno Nov 27, 2023Op onze Shopify Expert Marketplace kan je vele vertrouwde, externe organisaties en freelan...
By Arno Oct 30, 2023Black Friday Cyber Monday (BFCM) 2023 staat voor de deur. Of je nou een beginnende onderne...
By Lee Oct 23, 2023