Shopify themes, liquid, logos, and UX
Hello, I am using Craft theme.
This email section is default one from shopify admin.
This is not email pop-up. I have already contacted service team from Vital, where i use email pop-up app and they say it is not related with them. It is true though.
I want to be it like when someone type in their email and subscribe, I want the disocount code to show up.
I have already created discount code for this.
If it is impossible, is there any alternate way to do it?
ill
To show the discount code immediately after someone subscribes using the default Shopify email signup form, you'll need to customize the form a bit with some code. Here’s a way to do it:
Edit the theme code: Go to your Shopify admin, click on "Online Store," then "Themes." Click "Actions" next to your current theme and select "Edit code."
Find the form: Look for the file that contains your email signup form. It could be in a file like footer.liquid or a section file related to the footer.
Add JavaScript for the discount: You’ll need to add some JavaScript to display the discount code upon form submission. Here’s an example of what the code could look like:
<script>
document.addEventListener('DOMContentLoaded', function() {
var form = document.querySelector('form'); // Adjust the selector to match your form
form.addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the default form submission
var discountCode = 'YOUR_DISCOUNT_CODE'; // Replace with your actual discount code
alert('Thank you for subscribing! Use code ' + discountCode + ' for 10% off your first order.');
form.submit(); // Now submit the form
});
});
</script>
If this fixed your issue, likes and accepting as a solution are highly appreciated
| Build an online presence with our custom-built Shopify Theme: EcomifyTheme
| Check out our reviews: Trustpilot Reviews
| We are Shopify Partners: EcomGraduates Shopify Partner
Add JavaScript for the discount: You’ll need to add some JavaScript to display the discount code upon form submission. Here’s an example of what the code could look like:
<script>
document.addEventListener('DOMContentLoaded', function() {
var form = document.querySelector('form'); // Adjust the selector to match your form
form.addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the default form submission
var discountCode = 'YOUR_DISCOUNT_CODE'; // Replace with your actual discount code
alert('Thank you for subscribing! Use code ' + discountCode + ' for 10% off your first order.');
form.submit(); // Now submit the form
});
});
</script>
If this fixed your issue, likes and accepting as a solution are highly appreciated
| Build an online presence with our custom-built Shopify Theme: EcomifyTheme
| Check out our reviews: Trustpilot Reviews
| We are Shopify Partners: EcomGraduates Shopify Partner
It is not working.
the place where i put is in section> email sign up banner liquid
I do not k now what adjust the selector to match my form mean so i just put h2 which i saw on a youtube.
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025