Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Issue:
Displaying the discounted price of a product that qualifies for an automatic discount on a custom frontend
Summary:
We are looking for guidance on displaying the sales price of a product that belongs to a collection that falls under an automatic discount. We wonder if there is a way to do this without using the Admin API.
Example:
The seller has created an automatic discount that reduces the price for all products that fall under the collection "Beach" by 20%
On our product index page (custom Next.js app), the sales price needs to have a strikethrough with the discounted price next to it. Is this possible through the Storefront API?
Automatic discounts are available in the storefront API under checkout -> lineItems -> discountAllocations but these are specific to the customer rather than the product so I'm not sure how you could get them to display on the product page.
The normal way to display a price with a strikethrough on product pages would be using the compareAtPrice.