---
schema_version: "1"
id: d9fe582ed9209844dbbcfef1e21a3a3f9aaf5c920c5a585a6a3971d392af7404
title: Source Code Based Price Books and Promotions
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/commerce-api/guides/shopper-context-api-source-code.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/shopper-context-api-source-code.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: fd0de32ba69bed9f725fec55ecceffa9f15c4101533dde9cc586ee0ae0887fdd
products:
  - Composable Storefront
  - Salesforce APIs
---
# Source Code Based Price Books and Promotions

To activate source code based price books and promotions, follow the steps listed below:

## Set the Shopper Context

1. Follow the instructions in [Set and Retrieve Shopper Context](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/shopper-context-api.md#set-and-retrieve-shopper-context).
2. Set the qualifier as key and value pair, making sure you use the same qualifier name as in the assignment.
   - `customQualifiers`: Set when you want to trigger pricing and promotion experiences using a dynamic session-based customer group.
   - `assignmentQualifiers`: Set when using the assignment framework. Can be used to trigger pricing and promotion experiences in pages such as Products, Product Search, Basket, and Shipping method. Be sure to use the same qualifier name as in the assignment.
   - `sourceCode`: Set the source code to evaluate source code group that triggers the promotion (campaign assignment) and Price books (assigned to Source code group).

```json
{
  "sourceCode": "wii1-98"
}
```

## See Also

- [createShopperContext](https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-context?meta=createShopperContext)
- [Shopper Login (SLAS)](https://developer.salesforce.com/docs/commerce/commerce-api/references/auth?meta=Summary)
- [Assign a Price Book or Promotion to a Specific Store in B2C Commerce](https://help.salesforce.com/s/articleView?id=cc.b2c_assigning_a_pricebook_or_promotion_specific.htm&type=5) in _Salesforce Help_
