Pre generated Dynamic Discount Code to show in a welcome pop up

Pre generated Dynamic Discount Code to show in a welcome pop up

Macoy102890
Tourist
8 0 2

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. 

Reply 1 (1)

Small_Task_Help
Shopify Partner
830 27 75

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

To Get Shopify Experts Help, E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert Agency
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad