# Order Edit and Refund Handling in Dollarback

{% hint style="success" %}
Available only on the new “Advanced” Plan. Logic for [existing plans](#behavior-across-plans) is described below.

\
Install the app if you haven't already.

<https://apps.shopify.com/dollarback>
{% endhint %}

***

### Overview

The **Order Edit and Refund Handling** feature allows cashback rewards to automatically adjust when orders are **edited**, **refunded**, or **canceled** on Shopify.

This means your customers’ store credit always reflects the **true value of their completed purchase**, even if you later issue a refund or make order changes.

{% embed url="<https://dollarlabs.neetorecord.com/watch/1c215428f15c65852ba1>" %}

***

### ⚙️ Enabling the Feature

1. Open the **Dollarback App** in your Shopify Admin.
2. Navigate to **Settings → Enable Order Edit Handling**.
3. Check the box **“Enable order edit functionality”**.
4. Click **Save Settings**.

Once enabled, the app will begin dynamically recalculating rewards for all orders.

***

### 🧭 How It Works

Dollarback automatically tracks order changes and adjusts the corresponding cashback or store credit balance.

Let’s go through how this works in different scenarios:

#### 1. Order is Refunded (Full or Partial)

* When you **refund items or the full order**, Dollarback automatically **debits** the customer’s store credit.
* The change is logged in the **Order Edit History** meta field.

If the customer **doesn’t have enough credit** to cover the debit, Dollarback records the owed balance under a metafield called **“Balance Adjustment”**, allowing you to track pending deductions.

***

#### 2. Order is Edited (Items Added or Removed)

* When items are **added or removed** or when discount / shipping is updated. Dollarback logs the change, but **waits** until the order is marked **Paid**.
* Once marked Paid, the cashback is **recalculated** based on the **new subtotal** and **credited** to the customer’s account.

This ensures cashback adjustments happen only for finalized changes.

***

#### 3. Order is Canceled

When an order is canceled in Shopify:

* Dollarback **debites** the entire credited cashback for that order from the customer’s store credit.
* The event is logged in **Order Edit History**.

***

### 📜 How Rewards Are Calculated

When an order is placed, Dollarback saves a **snapshot** of:

* The customer’s tags (e.g., VIP, Bronze, etc.)
* The cashback configuration active at that time

These snapshots ensure that:

* Cashback is always based on the conditions at the **time of purchase**, even if customer tags or configurations change later.
* The only dynamic check performed later is to determine which collections a product is part of, since collections can change frequently and dynamically and it is infeasible to store the entire catalogue.

***

### 💳 Metafields You Should Pin

For better visibility in Shopify Admin, we recommend pinning these metafields to your order and customer pages:

<table><thead><tr><th>Metafield</th><th width="135.68359375">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Cashback Details</strong></td><td>Order</td><td>Shows the latest credited cashback for that order.</td></tr><tr><td><strong>Order Edit History</strong></td><td>Order</td><td>Shows all cashback debit/credit events for that order.</td></tr><tr><td><strong>Balance Adjustment</strong></td><td>Customer</td><td>Tracks pending debit if the customer’s balance goes negative.</td></tr></tbody></table>

To pin them:

1. Open any order or customer in Shopify.
2. Click **“View all”** under Metafields.
3. Find the relevant metafield and click the **📌 Pin** icon.

***

### 🔁 Behavior Across Plans

| Scenario              | Old Plan (“Pro”)                                                                               | New Plan (“Advanced”)                                                                                                                                                                       |
| --------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Normal Rewards**    | <p>Refunds are skipped; </p><p>Order Edits are skipped; cashback not recalculated.</p>         | Refunds and order edits are handled automatically.                                                                                                                                          |
| **Scheduled Rewards** | No recalculation at the time of awarding credit. Rewards are given as per initial order state. | <p>Scheduled rewards are recalculated based on the order information <strong>at the time of credit</strong>.<br><br>Any new change after the credit is issued is not taken into account</p> |

> 💬 **Note:**\
> For all previously created scheduled rewards (before this feature was enabled), the existing behavior continues — **refunds and edits are not supported**.

***

### ⚠️ Shopify Warning for Item-less Refunds

If a refund is issued **without selecting specific line items**, Shopify shows the following warning:

> “To avoid unexpected refunds, select items being refunded. For partial refunds, edit the order to add a discount.”

In such cases, Dollarback **will not** recalculate cashback since item-level context is missing.

***

### 📦 Handling Old Orders

For orders placed **before** enabling this feature:

If you refund or edit an old order **after** enabling the setting, cashback will now be recalculated for that order. (if it wasn't a scheduled reward)

***

### 🔔 Notifications and Event Updates

Dollarback does not trigger **store credit notifications** configured in the app (credited/debited) for order edits and partial refunds by default, since these differ from regular earning or redemption events.

#### Variables Sent

Each **Store Credit Credited** or **Store Credit Debited** event includes these variables:

* `orderId` - Shopify Order ID that's on the URL&#x20;
* `orderName` - Internal order ID typically starts with #
* `eventType`&#x20;

#### Possible `eventType` Values and Their Meanings

<table><thead><tr><th width="188.515625">Event Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>order created</strong></td><td>Cashback was given when the order was created (usually on checkout completion).</td></tr><tr><td><strong>order paid</strong></td><td>Cashback was given when the order was paid (usually on checkout completion).</td></tr><tr><td><strong>order fulfilled</strong></td><td>Cashback was given after fulfilment, depending on your app settings.</td></tr><tr><td><strong>order updated</strong></td><td>Store credit was given for any new credit when the order is updated</td></tr><tr><td><strong>order refund</strong></td><td>Store credit was debited due to a line item removal through order edit / partial refund.</td></tr><tr><td><strong>order edited</strong></td><td>Store credit was debited due to Shipping / Discount application through order edit.</td></tr><tr><td><strong>order cancelled</strong></td><td>Store credit is fully debited when an order was cancelled or when all line items are removed.</td></tr><tr><td><strong>delayed cashback</strong></td><td>Cashback credit was delayed and processed later due to delay store credit = enabled.</td></tr></tbody></table>

You can use these variables in your integrations to:

* Create **custom notification flows** in Klaviyo or your email service.
* Send notifications for adjustment events and inform customers.

***

### 🆘 Need Help?

If you have questions or need assistance setting up **Order Edit and Refund Handling**, our team is available via **in-app chat support** or email.\
We’ll be happy to walk you through examples and ensure your cashback program runs seamlessly.
