---
schema_version: "1"
id: 38b136943aa752febe3b175b89443dc6008e8a94dbc4e132883d058786374244
title: Adding an Expression to a Commerce Component
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/commerce/264-0-0/comm_components_expressions_add.md
canonical_url: https://help.salesforce.com/s/articleView?id=commerce.comm_components_expressions_add.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 3dc6826d815407b572a31d2b9596be3b31642cd7160035657a29965b7cc7c1ae
description: Enter expressions into any LWR component on a page with data providers. In some components, you can select an expression from a provided list. You can also combine expressions or add values.
products:
  - Commerce
  - B2B Commerce
release: "264"
---
# Adding an Expression to a Commerce Component

Enter expressions into any LWR component on a page with data providers. In some components, you can select an expression from a provided list. You can also combine expressions or add values.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=commerce.comm_editions.htm&amp;language=en_US" target="_blank">View supported editions</a>.</td></tr></tbody></table>

[Which Salesforce Commerce Product Do I Have?](https://help.salesforce.com/s/articleView?id=commerce.comm_what_product.htm&language=en_US)

## B2B Store Pages with Data Providers

The expressions that you can use in a component depend on which data providers are available on the page. Pages with Commerce-related data provider components are:

- Cart page—Access cart details and totals
- Checkout page—Access checkout details
- Order Summary page—Access order data
- Product page—Access product data
- Search page—Access search data

Other places where data providers are available include:

- Record Detail page—Access record data for supported objects through expressions, such as {!Item.recordField}. See [All Supported Objects](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_all_supported_objects.htm).
- Any page—Access CMS content through the Banner, Card, Overlap, and Tile components. See [Use Expressions in LWR Sites](https://developer.salesforce.com/docs/atlas.en-us.exp_cloud_lwr.meta/exp_cloud_lwr/advanced_expressions.htm).

## Built-In Expressions

If a component includes built-in expressions, the Inherited Content field specifies which data is available. The component also includes a field where you can enter text or select an available expression.

For example, in this text block on a Cart page, the inherited content is Commerce Cart Data.

![Text block component with Commerce Cart Data inherited content. Text or Expression dropdown shows Show ID and Account ID expressions.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-commerce-comm-264-0-0-production-enus/d863e308-482a-4dfa-8d20-2a94737d394a/comm/images/comm_components_expression_built_in.png)

The available expressions shown pull in the store ID and the account ID associated with the cart.

The components with properties that indicate the presence of a data provider are: Banner, Button, Card, Grid, HTML Editor, Image, Overlap, Rich Content Editor, Text Block, Tile, and Video.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-commerce-comm-264-0-0-production-enus/d863e308-482a-4dfa-8d20-2a94737d394a/images/icon_example.png)

Example

- Show an offer that’s based on whether the unit price is more than $100.
    
    `{!Product.Pricing.unitPrice > 100}`—Returns true or false depending on whether the unit price is larger than 100.
- Create an offer based on whether the list price is less than the unit price.
    
    `{!Product.Pricing.listPrice < Product.Pricing.unitPrice}`—Returns true or false depending on whether the list price is smaller than the unit price.
- Show special deals based on a product’s brand.
    
    `{!Product.Details.fields.Name == 'someName'}`—Returns true when the product name equals ‘someName’.
- Highlight customer savings.
    
    `{!+Order.totalAmount - (+Order.adjustmentAggregates.totalProductPromotionDistAmount)}`—Returns the difference between the total amount and the promotion distribution amount.
- Show a product count next to the heading in the Cart Summary component.
    
    `Summary ({!Cart.Details.totalProductCount})`—Returns “Summary (X),” where X is the number of products in the cart.