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

# Set up cost settings

> Configure product costs, order costs, shipping, gateway fees, and fixed and variable costs in Upstack so your contribution margin and P&L reflect real profitability.

Cost settings are where you tell Upstack what it actually costs to fulfill an order. Once your costs are in, Upstack subtracts them from revenue to give you accurate contribution margin (CM1–CM4) and a real P\&L — not just revenue and ROAS. This guide walks through each cost category and how to set it up.

<Info>
  Cost settings are available to **admin and owner** roles, and may not be enabled on every account yet. If you don't see the Costs section in Settings, contact the Upstack team.
</Info>

## Where to find it

Open **Settings → Cost Overview** (under the **Costs** section of the settings menu). The overview lists every cost category as a card and shows which ones you've configured. Each card links to its own page.

<Tip>
  Two things to know before you start:

  * **Changes apply to past orders too.** When you add or edit a cost, Upstack recalculates matching historical orders within that cost's date range — so your reporting stays consistent.
  * **You can date every cost.** Most cost lines accept an effective start and end date, so a rate change from last month doesn't rewrite the months before it.
</Tip>

## Where to start

The overview marks **Gateways** and **Shipping** as recommended starting points — they apply to almost every order. A good first-time order:

1. **Gateways** — your payment processing fees
2. **Shipping** — what it costs to ship an order
3. **Product Defaults** — a fallback margin so every product has a cost
4. **Order Costs** — any other per-order or per-item fees

Add **Product Costs**, **Fixed Costs**, and **Variable Costs** as you need them.

## Product Defaults

Two settings that apply when a product is missing its own cost data:

* **Default COGS %** — a percentage of the item's sale price (0–100), used as the cost of goods for any product that has no specific cost. This is the fallback when a variant has no cost.
* **Global Handling Fee** — a flat amount added per line item. This is a separate handling cost that applies whenever it's set; it isn't part of the product-cost fallback.

Set the Default COGS % first so no order is ever missing a product cost.

## Product Costs

Per-variant cost overrides. If you maintain **Cost per item** in Shopify, Upstack syncs it automatically — those synced costs are read-only here. You can also enter your own cost for any variant, with effective date ranges; your manual entry takes precedence over the Shopify-synced value.

<Note>
  Give each cost entry for a variant a **different start date**. If two entries share the same start date, only one of them is used for an order, and Upstack flags the duplicate so you can fix it.
</Note>

## Order Costs

Fees that apply per order, per line item, or per refund — beyond product cost. For each cost line you choose how it's calculated:

| Type                                             | What it does                        |
| ------------------------------------------------ | ----------------------------------- |
| Per Order / Per Line Item                        | A flat amount per order or per item |
| Per Refund Order / Per Refund Line Item          | A flat amount applied on refunds    |
| By Order Weight                                  | Tiered by the order's weight        |
| By Order Quantity / By Line Item Quantity        | Tiered by how many units            |
| % of COGS / Shipping / Total / Gross / Net Sales | A percentage of the chosen base     |

Each cost line is assigned a **category** (COGS, Fulfillment, Transaction, Marketing, Agency Fees, Opex, or Other) — which determines its contribution-margin tier — and a **channel** (Online, POS, or Both). Rich filters let you scope a cost to specific gateways, tags, vendors, product types, countries, or products.

## Shipping

Choose how Upstack accounts for shipping cost, using one of three modes:

| Mode                             | When to use it                                          |
| -------------------------------- | ------------------------------------------------------- |
| **Use Shopify Shipping Charges** | Use the shipping amount already on your Shopify orders  |
| **Fixed Rate Per Order**         | Apply one flat shipping cost to every order             |
| **Shipping Profiles**            | Set rates by country/region — flat, or tiered by weight |

With **Shipping Profiles**, each profile matches one or more countries. A profile can be a single **Flat Rate** or **Weight Tiered**, and you can set a default profile as a fallback.

<Warning>
  If two shipping profiles cover the same country, Upstack shows an **Overlapping Shipping Profiles** warning and uses the first match. Keep country coverage distinct so the right rate always applies.
</Warning>

## Gateways

Payment processing fees per gateway, entered as a flat amount plus a percentage:

* **Flat Fee** — a fixed amount per transaction (e.g. \$0.30)
* **Percent Fee (%)** — a percentage of the order (e.g. 2.9%)

Gateway names are discovered from your order history, so you only configure the ones you actually use.

## Fixed Costs

Recurring overheads like rent, salaries, and software subscriptions. Set an amount and a **frequency** — Daily, Weekly, Monthly, Quarterly, or Yearly — and a **category** (Marketing, Opex, Agency Fees, or Other). Upstack averages the cost across the period so it shows up correctly in your P\&L.

## Variable Costs

Costs that scale with ad spend. Today this is **% of Ad Spend** — a percentage applied to your ad spend, with an optional filter for which ad platforms it applies to, under a **Marketing** or **Opex** category. Useful for agency fees or tools billed as a percentage of spend.

## How costs roll into contribution margin

Each cost's **category** decides which margin tier it reduces:

| Tier    | Reduced by costs in these categories            |
| ------- | ----------------------------------------------- |
| **CM1** | Cost of goods sold (product cost)               |
| **CM2** | Fulfillment, transaction, gateway, and shipping |
| **CM3** | Marketing — your marketing costs and ad spend   |
| **CM4** | Operating expenses, agency fees, and other      |

Fixed and variable costs land in the tier that matches the **category** you give them — a Marketing-category cost reduces CM3, while an Operating expenses, Agency fees, or Other cost reduces CM4.

See [Contribution margin](/get-started/configure-contribution-margin) for how the tiers are used across the P\&L dashboard.

## Frequently asked questions

<AccordionGroup>
  <Accordion title="Do cost changes apply to past orders?">
    Yes. When you add or edit a cost, Upstack recalculates matching historical orders within that cost's effective date range. Set start and end dates to control exactly which orders a cost applies to.
  </Accordion>

  <Accordion title="What happens if a product has no cost?">
    Its cost falls back to your **Default COGS %** from Product Defaults. (The Global Handling Fee is a separate cost that applies on its own, not part of this fallback.) Set the Default COGS % first so every order has a product cost.
  </Accordion>

  <Accordion title="Which costs land in which margin tier?">
    A cost's category determines its tier: COGS → CM1; Fulfillment, Transaction, Gateway, and Shipping → CM2; Marketing and ad spend → CM3; Operating expenses, Agency Fees, and Other → CM4. Fixed and variable costs follow the same rule — they land in the tier matching their category.
  </Accordion>

  <Accordion title="Can I set costs in a different currency?">
    Yes. You can enter a cost in its own currency, and Upstack converts it into the order's currency for you.
  </Accordion>

  <Accordion title="Who can edit cost settings?">
    Admin and owner roles. The Costs section may not be enabled on every account yet — contact the Upstack team if you don't see it.
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Contribution margin" icon="layer-group" href="/get-started/configure-contribution-margin">
    How CM1–CM4 and the P\&L dashboard use your costs.
  </Card>

  <Card title="Manage costs from the CLI" icon="terminal" href="/cli/costs">
    Read and update cost configuration with the `upstack costs` command.
  </Card>

  <Card title="Attribution and reporting" icon="chart-line" href="/concepts/attribution-and-reporting">
    How Upstack attributes conversions and calculates reporting metrics.
  </Card>

  <Card title="Costs API" icon="code" href="/api-reference/overview">
    Manage cost configuration programmatically.
  </Card>
</CardGroup>
