We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Dynamically display active coupon codes on page

Dynamically display active coupon codes on page

dev-steveo
Visitor
1 0 0

The goal is to have a page that dynamically displays active coupon codes to avoid updating the page manually. 

 

I had thought creating a boolean metafield would do the trick paired with some liquid on the page. However I don't see an option to create a discount metafield. I also learned that liquid templating doesn't natively support querying or displaying active discount codes directly since Shopify doesn't expose discount objects to the storefront or Liquid templates. We wouldn't want to display ALL active coupon codes anyways, only certain ones. 

 

Any ideas? 

Reply 1 (1)

BlackCro
Shopify Partner
103 19 19

I'm not sure if it's possible now that the Discount object has been deprecated. You can access codes currently applied to a cart, maybe there's a way to create a hidden cart somewhere which has the necessary products included, but that could get convoluted. 

Codes do have a unique URL which always starts with myshopify.com/discount/ so perhaps there is a way to access them that way? 

BlackCro.co.uk

CRO & Development Agency



Better Forms - Get a better contact form today!