#[1]gnikyt feed [2]gnikyt Code ramblings. Apply, verify, and validate Shopify discount codes /* Oct 19, 2018 — 737B */ Shopify doesn’t have an API to verify discounts, however, I have found a little workaround. By making an AJAX call to /discount/(code), Shopify will set a cookie telling the checkout to auto-apply a discount on a visit to the checkout page. Next, making an AJAX call to /checkout, we’re able to parse the HTML and determine if the discount code worked! Here’s an example of it in action: promo-verify promo-verify For the source code of this script, please see [3]this repository. [4]MD | [5]TXT | [6]CC-4.0 This post is 6 years old and may contain outdated information. __________________________________________________________________ [7]Ty King Ty King A self-taught, seasoned, and versatile developer from Newfoundland. Crafting innovative solutions with care and expertise. See more [8]about me. [9]Github [10]LinkedIn [11]CV [12]RSS * * * * * * * * * * References 1. /rss.xml 2. / 3. https://github.com/gnikyt/Shopify-Frontend-Helper 4. /apply-verify-and-validate-shopify-discount-codes/index.md 5. /apply-verify-and-validate-shopify-discount-codes/index.txt 6. https://creativecommons.org/licenses/by/4.0/ 7. /about 8. /about 9. https://github.com/gnikyt 10. https://linkedin.com/in/gnikyt 11. /assets/files/cv.pdf 12. /rss.xml