> For the complete documentation index, see [llms.txt](https://ctracker-docs.keywordrush.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ctracker-docs.keywordrush.com/putting-it-on-your-pages/overriding-templates.md).

# Overriding templates in your theme

Copy a template into your theme and Cashback Tracker uses yours instead. Plugin updates never touch it.

```
wp-content/plugins/cashback-tracker/templates/_shop-card.php
                                   ↓  copy to
wp-content/themes/your-theme/_shop-card.php
```

**Into your theme's root**, not a subfolder. The plugin asks WordPress for a file of that exact name and takes the first one it finds.

{% hint style="warning" %}
**Try the other two doors first.** An overridden template stops receiving improvements the moment you copy it, and every one is a file you now maintain across plugin updates.

Most of what people copy a template for is available without doing so — an **action** to add markup, a **filter** to change what a part says. See [Adding your own blocks to a shop page](/for-developers/shop-page-blocks.md).
{% endhint %}

### When an override is the right answer

* You need markup in an order no hook offers.
* You are replacing a part wholesale rather than adding to it.
* Your theme has its own card component and you want the plugin to use it.

### When it is not

* **Adding a line of text or a badge** — that is an action, and it keeps working after every update.
* **Changing what a row says** — that is a filter. The facts list, the coupon meta row, the trust and how-it-works blocks all take one.
* **Changing colours, spacing or type** — that is CSS. See [Colours and CSS](/putting-it-on-your-pages/colors-and-css.md).

### Override the smallest thing that works

A shop page is built from parts. Copying `single-cashback-shop.php` freezes the *whole page* — both layouts, every part, every hook position. Copying `_shop-identity.php` freezes one small file that draws a logo and a name.

Prefer the part. When the plugin improves the coupon card next release, a site that overrode `_shop-identity.php` gets the improvement; a site that overrode the page does not.

The full list of what you can copy is in the [Template reference](/for-developers/template-reference.md).

### Keeping an override working

An overridden template is a copy of one moment in the plugin's history. Two things drift:

**Variables.** A part receives named variables — `$post_id`, or `$coupon` and `$reserve_rail`. New ones may be added, and an old copy simply ignores them. That is safe: it renders the older shape.

**Class names.** Your copy keeps emitting the classes it was written with. If the shipped stylesheet stops styling one of them, your copy loses that styling silently — nothing errors, it just looks wrong.

{% hint style="info" %}
**After a major update, look at your overrides.** Compare each against the plugin's current version of the same file. `diff` is enough:

```
diff wp-content/themes/your-theme/_shop-card.php \
     wp-content/plugins/cashback-tracker/templates/_shop-card.php
```

What you want to see is your deliberate changes and nothing else. Anything you do not recognise is a change you have been missing.
{% endhint %}

### A worked example

Say every shop tile should carry your own "Verified partner" badge.

**Do not** copy `_shop-card.php` for that. Nothing in the plugin's card is wrong; you are adding to it. But the card has no action inside it, so this genuinely is an override — and the right one is the *card*, not the grid or the page:

```php
<?php // your-theme/_shop-card.php - copied from the plugin, one block added ?>
...
    <div class="cbtrkr_shop_card_name"><?php echo \esc_html(\get_the_title($shop_page->ID)); ?></div>

    <?php if (\get_post_meta($shop_page->ID, '_my_verified', true)): ?>
        <div class="my-verified-badge"><?php \esc_html_e('Verified partner', 'my-theme'); ?></div>
    <?php endif; ?>
...
```

One file, one addition, and the rest of the shop page keeps improving.

### Related

* [Adding your own blocks to a shop page](/for-developers/shop-page-blocks.md) — the hooks to try first
* [Template reference](/for-developers/template-reference.md) — every template and its variables
* [Colours and CSS](/putting-it-on-your-pages/colors-and-css.md)
