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.
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024