How to create discount codes via Shopify Flow using discountCodeBasicCreate mutation?

Topic summary

Issue: Creating discount codes via Shopify Flow’s “Send Admin API request” using the discountCodeBasicCreate mutation fails with an error stating the mutation doesn’t exist on the unstable API version.

Latest update: Flow has adopted the GraphQL Admin API version 2025-10 (per Shopify changelog). The “Customer abandons checkout” trigger previously used the unstable version but should now use the same stable version as other Flow tasks.

Evidence: One user successfully created a discount code via Flow, suggesting the mutation works under the current stable API version. A screenshot was shared confirming success.

API version control: There’s no indication you can manually specify the Admin API version in Flow; Flow uses a fixed version that was recently unified across tasks and triggers.

Alternatives and related actions: For sending emails, you may need an app integration; gift cards are suggested as they are sent automatically. Saving abandoned cart items to a customer metafield is already working.

Status: Likely caused by the trigger running on the older unstable version; moving to the unified stable version should resolve. Open item: verify the trigger now runs on 2025-10 and configure email delivery via an app or gift cards.

Summarized with AI on December 10. AI used: gpt-5.

Hi everyone,

I’m trying to create discount codes automatically using Shopify Flow with the “Send Admin API request” action and the discountCodeBasicCreate mutation.

However, I’m getting this error:

“La mutación ‘discountCodeBasicCreate’ no existe en la versión unstable de la API”

According to the official GraphQL documentation, this mutation exists and should work, but Flow seems to be using the “unstable” API version.

My questions:

  1. Is there a way to specify the API version in Shopify Flow’s “Send Admin API request” action?

  2. Has anyone successfully created discount codes via Flow using this mutation?

  3. Is there an alternative approach to programmatically create discount codes from Flow?

What I’m trying to achieve:

  • Trigger: Customer abandons checkout

  • Action 1: Save abandoned cart products to customer metafield (this works)

  • Action 2: Create a discount code with expiration date (this fails)

  • Action 3: Send email with the discount code

Any help would be greatly appreciated!

Thanks!

Interesting.
Last official word was 2025-10:

https://help.shopify.com/en/manual/shopify-flow/concepts/admin-api

You’d probably need an App for “Send email”. Or create gift cards instead – they are sent automatically.

I’ve just created a discount code without problems:

1 Like

Customer abandons checkout previously used the unstable version, but should now use the same version as the rest of Flow tasks.

2 Likes