Personalized checkout and custom promotions with Shopify Scripts
Need to add a code snipet to this page
https://morningragecoffee.com/pages/ehrs-band-fundraiser
With a text box to enter a discount code - then press a button to be redirected to the URL with that entered discount code embedded, like this:
https://morningragecoffee.com/discount/ERHS24001
Thanks in advance
Hi @NewtoAllThis 👋 roughly use a custom-liquid section or block; assuming an OS2.0 theme
And some code like this UNTESTED code:
<script>
function redirectToDiscountURL(){
var discountCode=document.getElementById("discountCode").value;
var url="https://website.com/discount/"+discountCode;
window.location.href=url;
}
</script>
<input type="text" id="discountCode" placeholder="Enter discount code" />
<button onclick="redirectToDiscountURL()">Apply Discount</button>
Good luck.
If you need it further customized such as to be conditional or to use routes etc then contact me for services.
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024