---
title: "Generate Dynamic Shopify Discount Codes"
description: "Automatically create unique Shopify discount codes with the Generate discount code node and send them on WhatsApp."
url: https://help.getkanal.com/en/articles/80-generate-dynamic-shopify-discount-codes
collection: "Automations"
updated: 2026-11-17
language: en
alternates: [fr-fr]
---

# Generate Dynamic Shopify Discount Codes

Automatically create unique Shopify discount codes with the Generate discount code node and send them on WhatsApp.

The **Generate discount code** node automatically creates a unique discount code in your Shopify store, which you then send to the customer on WhatsApp.

> **Info:** **Requirements:** this node requires the Scale plan and a connected Shopify store. Since 21/05/2026, an automation that contains it cannot be turned on with a lower plan.

## Why use dynamic codes?

Unlike static codes (e.g. WELCOME10) that often end up on coupon sites, dynamic codes are:

-   **Unique**: each customer gets their own code, usable only once.
    
-   **Time-limited**: you can set a validity period to create a sense of urgency.
    

## Step 1: Add the Generate discount code node

1.  In the automation editor, click **Add an Action**.
    
2.  Select **Generate discount code**.
    
3.  Place this node right before the message that should contain the code.
    

## Step 2: Configure the discount

Click the node to open its settings.

### 1\. Code prefix

Kanal generates the code in the `PREFIX-XXXXXX` format: your prefix, a dash added automatically, then 6 random characters. The default prefix is KANAL. Type your prefix without a dash: `PROMO`, not `PROMO-`.

### 2\. Discount type

-   **Percentage**: from 1 to 100%.
    
-   **Fixed amount**: entered in euros. The discount is always in EUR, whatever your store currency.
    

### 3\. Validity

Choose how long the customer can use the code: 24 hours, 7 days, 30 days or unlimited. Expiration is calculated in UTC, which means a 1 to 2 hour offset compared with French time.

### 4\. Store

Keep the automatic option (from the trigger) or choose a specific store if you have several. Save your settings.

## Rules applied to the code

These rules are fixed and cannot be changed:

-   one use in total, once per customer;
    
-   valid on all products, for all customers;
    
-   combinable with product and shipping discounts, but not with order discounts;
    
-   also applied to subscriptions when possible.
    

## Step 3: Send the code to the customer

Each Generate discount code node creates its own variables, ending with the node ID (e.g. `4e205834b2`):

-   `{{variables.voucher_code_ID}}`: the generated code (e.g. PROMO-XXXXXX).
    
-   `{{variables.voucher_value_ID}}`: the discount value, shown as "15%" or "10.00 EUR".
    
-   `{{variables.voucher_expires_ID}}`: the expiration date, in DD/MM/YYYY HH:MM format (UTC), or "Unlimited" with no expiration.
    

Which message should you use?

-   If a conversation window is open (after a customer message or a click on a template button), connect the node to a **Send Message** and insert the variables in the text.
    
-   Otherwise (Abandoned Cart, Post Purchase), use a **Send Template** and map its variables to the code with the variable picker.
    

![](https://staticfiles.gleap.io/gattachments/ABVFKYNEeiyATDdP2VZ1UleVJ1sgeFQvnQgvxio35ahdeh63JbrXY5PxKzKdNcvpZZPtT5Uxt0A.png)

### Sample message

> "Hi! To thank you for your interest, here is a gift just for you:
> 
> Your discount code: **{{variables.voucher\_code\_4e205834b2}}**
> 
> Worth **{{variables.voucher\_value\_4e205834b2}}**
> 
> Valid until **{{variables.voucher\_expires\_4e205834b2}}**. Enjoy!"

## How does it work with Shopify?

1.  When the contact reaches the node, Kanal generates the code and creates it in your Shopify store with the rules above.
    
2.  The code appears in your Shopify admin, in the Discounts section.
    
3.  Kanal inserts the code into the WhatsApp message sent to the customer.
    

-   If the same contact goes through this node again during the same journey in the flow, they get the same code.
    
-   If the code cannot be created, the rest of the flow does not run: no message is sent with an empty code.
    

> **Tip**: combine this node with a **Wait time**. For example, wait 1 hour after a cart is abandoned before generating and sending a 10% code valid for 24 hours.
