Two discount codes with the same code

Jack_Ellis2
Shopify Partner
2 0 0

Hello, 

As far as I know you shouldn't be able to create two discount codes with the exact same value. When you try and do this in the admin dashboard it will say 

"A code with this name already exists. Try a new code."

We are using a webhook when you create a customer. When a customer is created our webhook reads the company name, takes the first part of the string, generates a random number between 0-9 and creates a 20% discount code assigned to this customer. 

Example: John from First Development

Company_Name+0-9+20

20 being the level of discount

Code would be something like FIRST720 or FIRST520

Ok so we've been doing this for a while and having no issues at all, now we have noticed that we have two discount codes exactly the same. The customer has reported that his discount code does not work on the store front. 

Screenshot showing two discount codes with the same codeScreenshot showing two discount codes with the same code

Above you can see that there are two, the first code is for a single customer and they are the one that has reported that it is not working. 

So you can open the discount code at the bottom fine, but when you click the top one it never loads, the only screen that you see is this:

Screenshot 2021-01-06 at 09.47.44.png

We can delete the other code and manually create a new one but we believe this may have happened a few times. 

I have just tried to create a discount code via the API with this same code and it returns what you'd expect: 

 

 

{
    "errors": {
        "code": [
            "must be unique. Please try a different code."
        ]
    }
}

 

 

My concern is that we have many more of these and these will continue to happen. I don't have a log of the response when the two codes were created but for some reason it let the second one pass through the system. 

I've spoken to live chat but they told me to hire an expert to fix this

Has anyone seen this before and how do I report it to Shopify?

Thanks, Jack

0 Likes