All things Shopify and commerce
Hi everyone. I just want to ask if anyone have done the same method of giving unique voucher code using popups for a new user.? Example: after a new user "sign up", it will pop up a welcome banner with a dynamic discount code. is there any particular app offer this feature?
If there's none, Do you know some script that it can call dynamic discounts code from the discount tab?
Thank you everyone.
Hi,
Hope following will help
Create a Discount Code
Use JavaScript to Generate Dynamic Codes
Javascript example
<!-- Include jQuery if you are not using it already -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<div id="welcome-popup" style="display:none;">
<h2>Welcome!</h2>
<p>Your unique discount code: <span id="discount-code"></span></p>
<button id="close-popup">Close</button>
</div>
<script>
$(document).ready(function() {
// Function to show the welcome pop-up with a dynamic discount code
function showWelcomePopup(discountCode) {
$('#discount-code').text(discountCode);
$('#welcome-popup').fadeIn();
}
// Simulate a new user sign-up (replace this with your actual sign-up logic)
$('#sign-up-form').on('submit', function(event) {
event.preventDefault();
// Assuming you generate or fetch a discount code from your discount tab
let discountCode = "WELCOME10"; // Replace this with dynamic code fetching logic
// Show the welcome popup
showWelcomePopup(discountCode);
});
// Close the popup
$('#close-popup').on('click', function() {
$('#welcome-popup').fadeOut();
});
});
</script>
Create an API endpoint to retrieve a discount code
Another method -
You can also use like Privy or ShopPop
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025