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
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024