# Cost Price

Cost price is a fixed cost price imported into Salesforce B2C Commerce for use in calculations. This 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 variation masters and products sets

## Standard Product

For a standard product that is neither a master product nor a product set, the cost price is imported and there is no default value.

## Master Product

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

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

Where:

mp is a master product

vpX are online variants of the master. The `IsOnline` attribute must be set to true for a product to count as an online variant.

X is the number of online variants.

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

Master 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

Master product

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

## Product Set

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:

This example shows how cost price is computed if not all product 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

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