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

# Returning Customer COGS: Cost of Goods for Repeat Buyers

> Track cost of goods sold for returning customer orders. Calculate repeat-buyer gross margin and compare cost structure across segments.

<Tip>
  Cost of goods sold for orders placed by returning customers—used to calculate repeat buyer gross margin.
</Tip>

## Formula

<Info>
  **Returning Customer COGS** = **SUM** ( Product Cost ) **WHERE** [customer\_type = returning\_customer](/data-dictionary/measures-and-dimensions#customer-type)
</Info>

### Formula Components

| Metric                                                                                             | Definition                                                 |
| -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| **Product Cost**                                                                                   | Cost of products in the order from Shopify inventory       |
| [**customer\_type = returning\_customer**](/data-dictionary/measures-and-dimensions#customer-type) | Filters to orders from customers who have purchased before |

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

***

## Example

Your returning customers generated **\$24,680** in COGS this month from 589 repeat orders:

| Segment             | COGS         | Revenue       | Gross Margin |
| ------------------- | ------------ | ------------- | ------------ |
| Returning Customers | \$24,680     | \$68,400      | 63.9%        |
| New Customers       | \$18,340     | \$47,200      | 61.1%        |
| **All Orders**      | **\$43,020** | **\$115,600** | **62.8%**    |

Returning customers have better margins—they buy fewer discounted starter products.

***

## How It Works

Returning Customer COGS sums the product costs for all orders placed by repeat buyers during the selected period. Product costs come from Shopify variant cost data. Compare to new customer COGS to understand how product mix differs by customer segment.

***

## When to Use

| Scenario                | Action                                       |
| ----------------------- | -------------------------------------------- |
| Retention profitability | Calculate repeat-order gross profit          |
| LTV modeling            | Use RC COGS in lifetime value calculations   |
| Segment cost structure  | Compare to NC COGS for product mix insights  |
| Margin by cohort        | Track if retention campaigns affect cost mix |

***

## Related Metrics

| Metric                                                                                                 | Relationship                          |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------- |
| [COGS](/reference/metrics/orders/cogs/cogs)                                                            | All customers combined                |
| [New Customer COGS](/reference/metrics/orders/cogs/new-customer-cogs)                                  | First-time buyer comparison           |
| [Returning Customer COGS Per Order](/reference/metrics/orders/cogs/returning-customer-cogs-per-order)  | Average cost per repeat order         |
| [Returning Customer Gross Revenue](/reference/metrics/orders/revenue/returning-customer-gross-revenue) | Used with RC COGS to calculate margin |

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