Cost price is a fixed cost price imported into Salesforce B2C Commerce for use in calculations. Cost price is a site-specific value and must be represented in the same currency used for purchases on the site.

Cost price:

- Is not staged and values are specific to each instance
- Has special handling for base products and products sets

For a standard product that is not a base product or a product set, the cost price is imported and there is no default value.

The cost price of a base product is equal to the average cost price of all variation products. The cost price is calculated using the following formula:

` Cost Price( `

*mp* ) =
SUM(Cost Price( *vpX* )) / *X*

Where:

*mp* is a base product

*vpX * are online variations of the base product. The `IsOnline`

attribute must be
set to true for a product to count as an online variation product.

*X* is the number of online variation products.

Example 1: Not All Variation Products Online

This example shows how cost price is computed if not all variation products are online. In this case, product 1 is online and product 2 isn't.

Variation product 1 - IsOnline: true

Cost Price: 5.50

Variation product 2 - IsOnline: false

Cost Price: 10.75

base product

Cost Price: (5.50) / 1 = 5.50

Example 2: all variation products Online

This example shows how cost price is computed if all variation products are online.

Variation product 1 - IsOnline: true

Cost Price: 7.50

Variation product 2 - IsOnline: true

Cost Price: 2.50

Base product

Cost Price: (7.50 + 2.50) / 2 = 5.00

The cost price for a product set is the sum of the cost prices for every product in the set.

```
Cost Price(
```

*sp* ) = SUM(Cost Price( *cpX* ))

Where:

*sp * is a product set

*cpX * are online products in the set:

Example 1: Not All Products Online

This example shows how cost price is computed if not all products in the set are online. In this case, product 1 is online and product 2 isn't.

Product 1 in set - IsOnline: true

Cost Price: 5.50

Product 2 in set - IsOnline: false

Cost Price: 10.75

Product set

Cost Price: = 5.50

Example 2: All Products Online

This example shows how cost price is computed if all products in the set are online.

Product 1 in set - IsOnline: true

Cost Price: 7.50

Product 2 in set - IsOnline: true

Cost Price: 2.50

Product set

Cost Price: (7.50 + 2.50) = 10.00