Buy x get y discount badge

sapiens_sapiens
Shopify Partner
19 0 1

Hello everyone,

Do you guys know if there is a way to show on the featured collection products a little badge for the Buy x Get y discount?
I set this type of discount for some of my products, and I would like to have it displayed in a badge.
I saw that the discount title is available in the cart (cart.item.discount.title) but I couldn't find this information in featured-collection.
Can any of you give me a hand with the issue and suggest a workaround? I would highly appreciate it.

Thank you a million.

Replies 2 (2)
NomtechSolution
Trailblazer
1245 111 139

Yes you can di it by

  1. Identify the discount title: First, make sure you have the discount title handy. This is the title you assigned to the "Buy x Get y" discount in your Shopify admin.

  2. Edit your featured collection template: Access your Shopify theme editor and locate the template responsible for rendering the featured collection section on your store's homepage or collection page. This might vary depending on the theme you're using, but commonly it's the collection-template.liquid or featured-collection.liquid.

  3. Add code to display the discount badge: Within the featured collection template, find the code that displays each product within the collection. You can typically look for a loop that iterates through the collection's products

Chat on WhatsApp: +923246370042
Need a Shopify developer? noumanmasood64@gmail.com
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
sapiens_sapiens
Shopify Partner
19 0 1

Hi, the problem is that the information I need does not seem to be available in featured-collection. The product does not have a discount property that I can target and display.
I could add it myself to the product, but I wonder where are the discounts saved, and how can I reach them? Any guess?