> ## Documentation Index
> Fetch the complete documentation index at: https://pricepirate.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Dynamic discounts

> Lower your marketplace price through a discount link without changing the regular price in your shop.

With **dynamic discounts**, PricePirate lowers the price a variant advertises on the marketplace without touching the regular price in your Shopify shop. Instead of overwriting the variant price directly, PricePirate creates a Shopify discount code and an **offer link** that applies the discount automatically. Only shoppers who arrive through that link get the lower price — your regular shop price stays unchanged for everyone else.

This wins you a better position on [Idealo](/docs/en/solutions/idealo-repricing) and other marketplaces without cutting your margin on direct sales through the shop.

<Note>
  Dynamic discounts are an alternative to direct price changes. With a direct change, PricePirate writes the new price to Shopify; with a dynamic discount, the regular price stays and the discount applies only through the offer link and the discount code.
</Note>

## Enable it

Dynamic discounts are enabled on two levels:

1. **Shop-wide** in [Settings](/docs/en/guide/account/settings) under **Dynamic discounts**. This toggle unlocks the feature for the whole shop and sets the [settings](#settings) below.
2. **Per product** in the [Strategy settings](/docs/en/guide/pricing/settings) dialog or on a [pricing strategy template](/docs/en/guide/pricing/templates). Only once a variant (or its template) uses dynamic discounts does a price decrease create a discount instead of a direct price change.

When you enable it per product, you confirm a notice dialog. A variant linked to a template follows the template's setting.

## Settings

In [Settings](/docs/en/guide/account/settings) under **Dynamic discounts** you define shop-wide how generated discounts look:

| Setting                       | Meaning                                                                                                              |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Advertised duration**       | How long a generated discount runs, in hours (default: 24).                                                          |
| **Code prefix**               | Optional text prepended to every generated discount code, for example `SALE`. Empty by default.                      |
| **Combines with**             | Whether the code can combine with your other Shopify discounts (product, order, shipping discounts). Off by default. |
| **Applies once per customer** | Limits redemption to once per customer. Off by default.                                                              |

## The discount box

So that the discount shows on the product page, add the **discount box** ("Discount box" in the theme editor) to your theme. It shows visitors the discounted price and the discount code.

To add the discount box:

1. In the Shopify admin, open **Online Store → Themes → Customize**.
2. Select a **product page** template.
3. Click **Add block** and choose **Discount box** by PricePirate.
4. Place the block where you want it and save.

Use the **Main text** field to adjust what the box shows. The following placeholders are available:

| Placeholder          | Content                      |
| -------------------- | ---------------------------- |
| `{discounted_price}` | The discounted price         |
| `{amount_off}`       | The discount amount          |
| `{percent_off}`      | The discount as a percentage |
| `{regular_price}`    | The regular price            |
| `{code}`             | The discount code            |

Optionally, the box shows a second line with a **"Valid until"** note and the date the code is valid through. You turn this line on or off with **Show expiry line**. You adjust the box's appearance and colors to match your theme through the block's remaining settings.

<Note>
  Without the discount box the discount still works through the offer link and the code — but the discounted price is not shown on the product page.
</Note>

## Dynamic discounts in price changes

When a strategy generates a decrease for a variant with dynamic discounts, the change appears under [Review price changes](/docs/en/guide/price-changes/review) as usual. The row shows the **regular price** as the new price and, next to it, a clickable **discount chip** with the discount amount (for example `−5.70 €`).

For applied discounts, the chip opens an action menu:

* **See discount on Shopify** — opens the discount in the Shopify admin.
* **Copy discount code** — copies the discount code to the clipboard.
* **Copy offer link** — copies the offer link to the clipboard.
* **Delete discount** — removes the discount after a confirmation. Already distributed or cached links to this code stop working afterward.

<Warning>
  Manage and delete dynamic discounts only through the action menu in PricePirate. Editing or deleting such a discount directly in Shopify can leave it in a corrupted state — shoppers may then get a broken discount link or see an incorrect discount on the product page.
</Warning>

## Good to know

* **The target price must be below the regular price.** The discount is subtracted from the current price. If your strategy calculates a price above the regular price, the change is recorded as **Invalid**.
* **Several codes can exist at the same time.** Each discount code is valid for the advertised duration (default: 24 hours). When a new decrease creates another code, the offer link always points to the newest discount; older codes stay valid until the end of their own window.
* **Only through the link or code.** The discount goes only to whoever uses the offer link or enters the code. The regular price in the shop stays unchanged.

## For marketplace connectors

PricePirate stores the discount on each variant in four metafields in the `price_pirate` namespace. A marketplace connector (for example the Idealo feed) reads these fields to advertise the discounted price and the offer link.

| Metafield         | Type                     | Content                                                                                                        |
| ----------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------- |
| `discount_active` | `boolean`                | Whether a discount is currently active.                                                                        |
| `offer_url`       | `url`                    | The offer link with the discount applied automatically. Set only while a discount is active — otherwise unset. |
| `discount_amount` | `number_decimal`         | The discount amount the connector subtracts from the variant price.                                            |
| `discount_code`   | `single_line_text_field` | The discount code.                                                                                             |

For the offer URL in the connector, use `offer_url` while it is set and otherwise fall back to the regular product URL. With Liquid:

```liquid theme={null}
{% if variant.metafields.price_pirate.offer_url != blank %}{{ variant.metafields.price_pirate.offer_url }}{% else %}https://{{ shop.domain }}/products/{{ product.handle }}?variant={{ variant.id }}&utm_source=idealo&utm_medium=cpc{% endif %}
```

<Note>
  The connector must support Liquid templates. If your connector does not use Liquid, use a supported connector such as [idealo EasyConnect](https://apps.shopify.com/idealo-easyconnect?locale=de).
</Note>

## Related

<Columns cols={2}>
  <Card title="Settings" href="/docs/en/guide/account/settings">
    Enable and configure dynamic discounts shop-wide.
  </Card>

  <Card title="Strategy settings" href="/docs/en/guide/pricing/settings">
    Enable dynamic discounts per variant.
  </Card>

  <Card title="Review price changes" href="/docs/en/guide/price-changes/review">
    Review and manage generated discounts.
  </Card>

  <Card title="Idealo repricing" href="/docs/en/solutions/idealo-repricing">
    Improve your position on Idealo.
  </Card>
</Columns>
