Bulk Creating Coupon Codes

Hi,

I need to create 1000 unique coupon codes which provide the customer with a 100% off voucher (giving away a free sample). The codes need to be unique though.

Is there a way to insert codes in bulk into the data table? Any help to do this would be massively appreciated.

Thanks

Hi, Tom.

I’m thinking that you could call the insert function (cf. https://www.wix.com/code/reference/wix-data.html#insert) in a loop (loop counter from 0 to 999 since JavaScript is 0-based).

HTH,

Art

1 Like

Thanks Art,

Im quite new to Wix, does anyone know how I can find what the name of the coupon collection is?

Thanks

Tom

Hi, Tom.

First question: have you created a database collection for the coupons codes in the Database section (furthest down in the Site Structure pane on the left-hand side)?

I did something likewise a while back and, with Yisrael´s help, I created something that creates unique coupons/vouchers by checking if it already exists in db, and if so, tiries another code. Look here:

Note: this generates random numbers, so not incremental.

Hi there,

Could you recommend me some kinda tool which would be ideal for sending unique codes to each customer after purchase please? The thing is, that I can’t send the same code more than once. Most of thr tutorials are about creating one layout of for example ‘thank you email with instructions’ so the same message is sent to multiple customers who subscribed or bought the same product. What if I want to share a unique code with each customer even they’re buying the same product? Can’t figure this out… Do you think the triggered emails by Velo would be suitable for this purpose? Thank you!

Sona

Why not sending the generated coupon-code via SMS directly to the user’s mobile-phone?

@russian-dima we want the codes to be sent instantly after the purchase and it’s not automatically generated code, let’s say we have a database of 1000 codes and they should be implemented into an email template and distributed right after the customer makes the purchase…

That also should’t be a problem.

You will find in this forum tonns of material for your project.

  1. https://www.wix.com/velo/forum/tips-tutorials-examples/sending-an-email-on-form-submission

  2. https://www.wix.com/velo/forum/tips-tutorials-examples/triggered-emails

  3. https://www.wix.com/velo/forum/community-discussion/sending-template-emails-with-sendgrid-v3

You will find even ready-to-go-examples like …

Good-luck!

oh that’s great, thank you so much for your help! I really appreciate it.

Perhaps you also take a look onto this one. But i do not remember, if this example was complete. Anyway, also read the related post for this example…

https://russian-dima.wixsite.com/meinewebsite/blank-6

Every information will expand your knowledge about all that stuff!

@russian-dima Cool, will try this as well, thanks!

1 Like

@sondaaa :wink:

Here, some additional info.
https://www.wix.com/velo/forum/community-discussion/how-to-add-image-as-a-parameter-to-triggered-emails

Post can be closed —> old and out of topic.

1 Like