Personalized checkout and custom promotions with Shopify Scripts
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).
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024