Personalized checkout and custom promotions with Shopify Scripts
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
Hi there! I added an optional checkbox to my store's Cart page by adding code to our theme.js and cart-template.liquid files (see below). Now I want to add an additional script to the Order Status so that the customers who checked the box get a special message. I've been looking through the posts about additional scripts and can't figure out what to put there. Any advice would be most welcome 🙂
Code I added to theme.js:
$(document).ready(function() {
$('body').on('click', '[name="checkout"], [name="goto_pp"], [name="goto_gc"]', function() {
if ($('#agree').is(':checked')) {
$(this).submit();
}
});
});
Code I added to cart-template.liquid:
<p style="float: none; clear: both; ">
<input style="float:none; vertical-align: middle;" type="checkbox" id="agree" />
<label style="display:inline; float:none" for="agree">I'm donating this toy to the <a href="/pages/hope-for-the-holidays-toy-drive">Hope For The Holidays Toy Drive</a>
</label>
</p>
For reference, my store uses the Debut theme (I know it's out of date, we just can't risk breaking the site with a new theme during the busiest shopping time of the year).