> ## 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.

# COGS: Cost of Goods Sold for All Orders

> Track your total cost of goods sold from Shopify orders. Use COGS to calculate gross profit, gross margin, and product-level profitability.

<Tip>
  The total cost of products sold, including manufacturing or purchase costs.
</Tip>

## Formula

<Info>
  **COGS** = **SUM** ( Product Cost × Quantity )
</Info>

### Formula Components

| Metric           | Definition                              |
| ---------------- | --------------------------------------- |
| **Product Cost** | Cost per unit from Shopify variant data |
| **Quantity**     | Number of units sold per line item      |

| Metadata        |                                                                         |
| --------------- | ----------------------------------------------------------------------- |
| **Type**        | Currency                                                                |
| **Data Source** | [Shopify](/sources/shopify), [Upstack Costs](/dashboard/settings/costs) |
| **Aggregation** | Sum                                                                     |

***

## Example

Your store sold **\$125,000** in January with **\$47,500** in product costs:

| Metric       | Value     |
| ------------ | --------- |
| Net Revenue  | \$125,000 |
| COGS         | \$47,500  |
| Gross Profit | \$77,500  |
| Gross Margin | 62%       |

***

## How It Works

COGS sums the cost-per-item values from your Shopify product variants multiplied by units sold. If product costs aren't set in Shopify, those items contribute \$0 to COGS. You can also override COGS in Upstack Cost Settings (e.g., "10% of net revenue").

***

## When to Use

| Scenario                 | Action                                      |
| ------------------------ | ------------------------------------------- |
| Calculating gross profit | Subtract COGS from Net Revenue              |
| Setting pricing          | Ensure prices cover COGS plus target margin |
| Comparing product lines  | Identify high-cost vs low-cost products     |
| Evaluating suppliers     | Track cost changes over time                |

***

## Related Metrics

| Metric                                                                            | Relationship                        |
| --------------------------------------------------------------------------------- | ----------------------------------- |
| [COGS Per Order](/reference/metrics/orders/cogs/cogs-per-order)                   | Average product cost per order      |
| [New Customer COGS](/reference/metrics/orders/cogs/new-customer-cogs)             | COGS from first-time buyers only    |
| [Returning Customer COGS](/reference/metrics/orders/cogs/returning-customer-cogs) | COGS from repeat buyers only        |
| [Gross Profit](/reference/metrics/orders/contribution-margin/gross-profit)        | Net Revenue minus COGS              |
| [Net Revenue](/reference/metrics/orders/revenue/net-revenue)                      | Revenue used in margin calculations |

[See all COGS metrics →](/reference/metrics/orders/cogs)
