Expressions and data providers in Commerce component properties
Key Takeaway
The data providers on a page decide which expressions, written as {!expression}, a component can use.
Expressions are a special syntax that pull live data into the properties of components in an LWR store built in Experience Builder. You use them instead of static text so a component can show values such as a product's price or a cart's item count. The data an expression can reach depends on the data providers on the page. For example, product data is available on the Product page and cart data on the Cart page.
How an expression works
An expression uses the syntax {!expression} and resolves to a single value. An expression can contain literal values, variables, subexpressions, and operators. Method calls aren't allowed, so use operators, literal values, and subexpressions instead. When the page loads on the live site, the resolved value replaces the expression.
You can mix static text and expressions in one property. For example, the Cart Summary heading can hold static text plus a cart expression:
Summary ({!Cart.Details.totalProductCount})
=> Summary (X)The word Summary stays as typed, and X is the number of products in the cart.