discountRedeemCodeBulkAdd phantom redemption codes

Hey there, we’ve had an unhappy merchant reach out after they’d used our application to generate ~20 million redemption codes, and subsequently uninstalled.

After speaking with Shopify support, they were told that these are now considered ‘phantom’ codes - I assume after they’ve deleted the parent discount code?

At this point, we have no API key to check/verify what is going on for that store.

  • Surely Shopify has the ability to delete these redemption codes?
  • I’ve asked the merchant to reinstall - but I’m unsure if WE will be able to delete the codes on the merchants behalf.

I’d love to hear what the correct approach to this situation is from someone at Shopify :slight_smile:

Hey @bkspace The answer here depends on whether the parent discount (the DiscountCodeNode those ~20 million codes were added to) still exists on the store.

The discountCodeRedeemCodeBulkDelete mutation is the API path for removing redemption codes in bulk, but it requires the parent discountId as a required argument. If the parent discount still exists, reinstalling your app would restore API access, and you could use that mutation to delete the codes. You’d need the DiscountCodeNode ID, which you can look up via the codeDiscountNodes query once reinstalled.

If the parent discount was already deleted, there’s no API mutation that can target orphaned redemption codes without a parent. In that scenario, the merchant would need to work with Shopify support directly, as that kind of cleanup can’t be done through the API.

A couple of things that would help narrow down the right path. Does the parent discount still exist on the store, or was it deleted before or after the uninstall? And what specific problem are the “phantom” codes causing for the merchant right now (hitting the store’s discount code limit, conflicts when creating new codes, codes still visible in admin)?

Thanks for the quick reply @Donal-Shopify!

The merchant cannot create any new discount codes as they have 20,000,000 phantom codes.

They’ve been told by Shopify support that we can fix it. But the parent discounts have been deleted, and so we can’t do anything our side.

Is this something that Shopify can fix for the merchant?

You’re right - with the parent discounts deleted, there’s no API path to reach those orphaned redemption codes.

At this point the merchant should follow up with Shopify support, reference this thread, and ask to be escalated to Technical Merchant Support. They can work with our Discounts team to investigate further and clear the orphaned codes if need be.

From what I can see internally, the job that deletes the price rules and their associated codes runs asynchronously after an app is uninstalled. There’s a chance the job hadn’t finished yet when the Merchant tried create new discount codes, but Technical Merchant Support will be able to take a look and confirm

1 Like

Thanks @Donal-Shopify. Is there any way we can escalate this for the merchant, as they’ve not been able to generate codes for quite a while now.

They’ve also frustratingly left us a 1* review, but there’s not really anything we can do (as discussed).

@bkspace Sent you a DM!

1 Like

This has now been fixed for the merchant/store in question. I’ve been told that work is ongoing to prevent this from occurring again, which is fantastic. In fact, I’m not sure if it’s already solved.

Thanks again @Donal-Shopify!

Glad to hear it’s sorted, @bkspace! The cleanup process that handles orphaned codes after a parent discount is deleted was hitting a timeout at that volume (~20M codes). Our team identified the bottleneck and shipped a fix so the process can handle large batches going forward.

Thanks for your patience while we worked on getting this sorted!

1 Like