Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rody 80 posts 280 karma points
    Oct 13, 2020 @ 12:19
    Rody
    0

    Importing multiple discount codes

    Hi,

    Is there a possibility to import unique discount codes in bulk? Our client has 5000 unique codes which they want to give out on a printed gift card. Each code can only be used once, in the discount Vendr back-end I can ofcourse add the codes 1 by 1, but this is a bit tedious for 5000 codes ;-)

    Is it possible to import these, or generate unique codes in bulk? In the past (using TeaCommerce) we used to create a custom section and functionality for this to generate random discount codes, and this is no problem. I was just wondering if I missed some standard option or functionality maybe, or this is on a future roadmap, so I can inform the client.

    Thanks!

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 14, 2020 @ 08:17
    Matt Brailsford
    100

    Hi Rody,

    Discount codes are held in the vendrDiscountCode table and consist of a unique guid, the associated store and discount ids and then the code an it's usage limits.

    You could populate this table yourself, though you may have to invalidate the cache for the discount in order for it to update in memory.

    The only problem I can see is in the discount displaying 5000 discount codes which would make the editor really rather long.

    Another option might be to implement your own discount rule (https://vendr.net/docs/core/1-3-0/key-concepts/discount-rules-and-rewards/) and store the discount codes in another location and create a better UI to handle them.

    I wonder if we need to have a better UI for discount codes beyond a certain amount as what we have currently is probably fine for a handful of codes, but after a while the list would probably get really rather long. Not sure what a better UI would look like though. I'll have to give that some thought. 🤔

    Hope this helps though

    Mat

  • Rody 80 posts 280 karma points
    Oct 14, 2020 @ 18:38
    Rody
    0

    Hi Matt,

    Thanks again for the quick and clear reply. For now we have implemented this in 2 separate discount rules with 2500 codes whice I inserted using an SQL script. This works fine. The discount interface is a little slow now (understandably), but it's definitely workable. 5000 was a bit too much.

    However if you try to save the discount from the Vendr back-end the "codes" label gets red. I think there might be a validation error on the page which is triggered?

    For now it's no big deal, for us this solutions works fine.

    Rody

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 15, 2020 @ 08:25
    Matt Brailsford
    0

    Hi Rody,

    I'm guessing the red validation rule will likely be because we regex validation on the code format of [A-Z0-9_\-]+ ie, all upper case alphanumberic with either underscores of hyphens. My guess is that your codes don't match this format.

    I don't think it'll be a problem in the code use, it just obviously errors in the back office if they aren't what we expect.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft