> For the complete documentation index, see [llms.txt](https://docs.samita.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.samita.io/discounts/create-discount-code.md).

# Create a discount code

Build a discount your shoppers unlock with a code at checkout — set the code, the value, the schedule, and the products it covers.

A discount code only applies when the shopper types it at checkout, which makes it the right type for campaigns, newsletters, and influencer partnerships.

The editor is the same as for an automatic discount, with two differences: there is a **Discount code** field, and there is no **New price display** option — a code does not exist until it is entered, so the price on the product page cannot be changed in advance.

{% stepper %}
{% step %}

## Open the Discounts page

In your Shopify admin, open the **Sami Product Labels** app and click **Discounts** in the app sidebar.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-4088514134d9b1a9574c02d8df56293123159de2%2Fimage_229.png?alt=media" alt="The Discounts entry in the Sami Product Labels app sidebar"><figcaption><p>Discounts sits between Badge groups and Extra Features in the sidebar.</p></figcaption></figure>
{% endstep %}

{% step %}

## Click Create discount, then choose Discount code

Click **Create discount**. In the **Choose discount type** dialog, click **Select** next to **Discount code**.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-fc55b0e94411cdfa745a7341f93e095fdce6cc1b%2Fimage_240.png?alt=media" alt="The Choose discount type dialog with Select highlighted next to Discount code"><figcaption><p>The page heading becomes Create discount code.</p></figcaption></figure>

{% hint style="info" %}
The type cannot be changed later. For a discount that applies on its own, see [Create an automatic discount](/discounts/create-automatic-discount.md).
{% endhint %}
{% endstep %}

{% step %}

## Name the discount and set its status

In **General information**, type a **Discount name** — internal only, and unique in your store — and set the selector beside it to **Active** or **Draft**.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-36c754ea4e6408285671aeac9de07fbf510e6068%2Fimage_241.png?alt=media" alt="The General information section of a discount code with the name field and the Active/Draft selector"><figcaption><p>The name is what you see in the list; the code is what shoppers type.</p></figcaption></figure>
{% endstep %}

{% step %}

## Set the discount code

In the **Discount** section, type the code shoppers will enter into **Discount code**, or click **Generate random code** to have the app produce a 12-character code for you.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-6e19df9f19a8c722d083eac35a8083652d5bb857%2Fimage_242.png?alt=media" alt="The Discount code field with a generated code and the Generate random code link"><figcaption><p>Customers must enter this code at checkout to apply the discount.</p></figcaption></figure>

{% hint style="warning" %}
The code is required, and it has to be unique — another discount in your store cannot already use it.
{% endhint %}
{% endstep %}

{% step %}

## Set the discount value

Below the code, pick a **Discount value** type and enter the number:

| Type               | What it does                                                              |
| ------------------ | ------------------------------------------------------------------------- |
| **Percentage (%)** | Takes that percentage off each matching item. Maximum 100%.               |
| **Fixed amount**   | Takes that amount off each matching item, in your store currency.         |
| **New price**      | Sells each matching item at the price you type, instead of its own price. |

Then choose a **Purchase type**: **One-time purchase**, **Subscription**, or **Both one-time purchase and subscription**.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-0e74bd8bed4b5e3127f9d3bcb1276ac9fddd6da8%2Fimage_243.png?alt=media" alt="The discount value type, value field, and purchase type selector on a discount code"><figcaption><p>The value field switches between a % suffix and your currency prefix.</p></figcaption></figure>
{% endstep %}

{% step %}

## (Optional) Add a minimum purchase requirement

Open the **Requirement** selector in **Minimum purchase requirements** and choose **No minimum requirements**, **Minimum purchase amount**, or **Minimum quantity of items**. The last two add a **Requirement value** field, counted only across the products this discount applies to.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-a1099a10e0291283737261535bbdeacdf4229df0%2Fimage_244.png?alt=media" alt="The Minimum purchase requirements section with a requirement value field"><figcaption><p>The cart has to reach this value before the code is accepted.</p></figcaption></figure>
{% endstep %}

{% step %}

## Schedule the discount

In **Discount time**, set the **Start date** and **Start time**, pre-filled with the current date and time. Tick **Set end date** to add an **End date** and **End time**; the end must be later than the start.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-1c5f25b3d09360f5911c17113b51b07e603e6ebc%2Fimage_245.png?alt=media" alt="The Discount time section with start date, start time, and the Set end date checkbox"><figcaption><p>Give campaign codes an end date so they stop working on their own.</p></figcaption></figure>
{% endstep %}

{% step %}

## Choose which discounts it can combine with

**Combinations** starts with **Product discounts**, **Order discounts**, and **Shipping discounts** all allowed. Click the **x** on a row to stop this code from stacking with that type; the pencil icon in the section header reopens the full list of checkboxes.

Click the counter on a row to see which active discounts of that type your store already has.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-49d66103af81117b53c9269489c874bb5f1c0b9d%2Fimage_246.png?alt=media" alt="The Combinations section of a discount code with the three combination types"><figcaption><p>Only one shipping discount can apply per order — the best value wins.</p></figcaption></figure>
{% endstep %}

{% step %}

## (Optional) Add tags

Click **Add tags** in the **Tags** section to tick an existing discount tag or create a new one. Tags are internal and are used to filter your discounts.
{% endstep %}

{% step %}

## Choose which products the code applies to

Switch to the **Product conditions** tab and pick **All products**, **Specific products**, or **Matching conditions**.

For **Specific products**, search in the field or click **Browse** to open the Shopify product picker, then use **Edit** on a row to narrow the selection down to individual variants.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-370a92ffb89d9d13774db812756ff17bbba26bb2%2Fimage_247.png?alt=media" alt="The Product conditions tab of a discount code with the three product modes"><figcaption><p>The code is only accepted for the products this tab covers.</p></figcaption></figure>

{% hint style="info" %}
To match products by collection, title, or tag instead of listing them, see [Use matching conditions](/discounts/matching-conditions.md).
{% endhint %}
{% endstep %}

{% step %}

## Save and share the code

Click **Save** in the bar at the top of the screen. Errors, if any, appear in a red banner and the editor jumps to the tab that owns the first one.

Back on the **Discounts** page, the row shows **Discount code** as its type with the code beside it — use the copy button to put the code on your clipboard before sharing it.

<figure><img src="https://1598842017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1WRTlT5AcaLSAedbCJyZ%2Fuploads%2Fgit-blob-526362859e99db866d9919d0772b60be117efcda%2Fimage_248.png?alt=media" alt="A discount code row in the Discounts list with the code and its copy button"><figcaption><p>Copy the code straight from the list when you are ready to publish the campaign.</p></figcaption></figure>
{% endstep %}
{% endstepper %}

## Show the code on your product pages

A discount code cannot change the price shown on your storefront, but a badge can advertise it. After saving, click **Create badge** on the **Don't let this discount go unnoticed** card and write the code into the badge text with the `{sami_discount_code}` variable.

{% hint style="info" %}
`{sami_discount_code}` only resolves on a badge that uses the **Sami discount** condition — which the **Create badge** button sets up for you. See [Dynamic variables reference](/reference/dynamic-variables-reference.md).
{% endhint %}

## Next steps

* [Use matching conditions](/discounts/matching-conditions.md) — match products by collection, title, or tag instead of picking them one by one.
* [Create an automatic discount](/discounts/create-automatic-discount.md) — a discount that applies itself, with no code to share.
* [Discounts overview](/discounts/overview.md) — statuses, plan limits, and how discounts connect to badges.

{% hint style="success" %}
**Need support?**

If you run into any difficulty while following these steps, contact us at <support@samita.io>.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.samita.io/discounts/create-discount-code.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
