# 6. Code Campaigns

{% embed url="<https://www.youtube.com/watch?index=6&list=PLGASFo0vRDpks4cfL2V9D0z3Cm78A92Hq&v=gCq6EQTksKg>" %}

Campaign codes are similar to Shopify's discount codes but allow for a single code to be specified for multiple discounts.

Since we have already created two automatic campaigns, let's now create our first Code campaign. Lets name the campaign "Special Offer" and choose the method "Campaign code." Specify the code that you will share with customers.

<figure><img src="/files/zW2iDciI1TUVcQZo7xyU" alt=""><figcaption></figcaption></figure>

Next, select customer eligibility. You can choose to apply the campaign to all customers, specific customer segments, or specific customers. Optionally, specify usage limits per customer or in total.

Define the active dates for the campaign. Add discounts to the campaign, similar to what we did for automatic campaigns. For this example, we will add two discounts. Finally, click "Save."

&#x20;On the campaigns page, you will see that our Code discount has been created.

<figure><img src="/files/MowqROyQaAh1nq00whHN" alt=""><figcaption></figcaption></figure>

Preview the app. In the widget, you will now see a Discount Code input field and an apply button alongside our two automatic campaigns. If you input the campaign code and click "Apply," the "Special Offer" campaign will become visible.

<figure><img src="/files/b02VeXEIBvxIlPDM8B0z" alt=""><figcaption></figcaption></figure>

Customers can add products to their cart to qualify for the discounts in this campaign.

Click "Checkout." On the checkout page, the code is already applied, and the discount is calculated. Customers can apply the code directly from the checkout page without using the widget.

<figure><img src="/files/XBeQBFTLL30E5bgsxQbT" alt=""><figcaption></figcaption></figure>

Optionally, add a Discount code block to the cart page. To do this, go to "Online Store" > "Themes" > "Customize." Change the page to "Cart." Click "Add block" below the Subtotal price (or your preferred location). Choose "App" and click "Campaign Code." Save your changes.

<figure><img src="/files/gqlPi1RDeht1IpylEbOc" alt=""><figcaption></figcaption></figure>

Now, on the cart page, customers can apply the campaign code from the Campaign Code block.

<figure><img src="/files/RP2cFTJNNYoheuPr85yS" alt=""><figcaption></figcaption></figure>

Active automatic campaigns will continue to function alongside the Code campaign, but customers can apply only one campaign code at a time.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://uniocode.gitbook.io/stack-discounts/6.-code-campaigns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
