commerce.get_matrix_price snippet is used to fetch the minimum and/or maximum price of products that are available in a product matrix.
- Use commerce.get_matrix for outputting the full range of products your matrix contains.
- Use commerce.get_matrix_first_product if you want to display more information about a first/default product, like images or stock.
Added in 0.12.0-pl.
[[!commerce.get_matrix_price? &matrix=`[[+tv.product_matrix]]` &getMin=`1` &getMax=`1` &inStockOnly=`1` ]]
[[+tv.product_matrix]] with the ID of the matrix or
[[*product_matrix]] when using the snippet on the page that holds the Matrix TV itself.
The above, with
inStockOnly all enabled, will return the minimum and maximum price for products in your matrix, separated by an n-dash.
If the minimum and the maximum price are the same, or you only provide getMin OR getMax, only the single price is shown. For example:
Products that are in rows or columns that have been deactivated are ignored. You can also ignore products that are not in stock by specifying
If no product with stock can be found, the snippet returns the
commerce.not_in_stock lexicon, or what you provide in
&matrix: the ID of the product matrix to load products from.
&getMin: get the lowest price from the matrix, defaults to
1, set to
&getMax: get the highest price from the matrix, defaults to
0, set to
&inStockOnly: only look for prices for products that have stock available. Defaults to
0, set to
&separator: the string to use between the minimum and maximum price (if getMin and getMax are both provided, and they return different prices). Defaults to an n-dash (
&noPriceAvailable: the string to return when no price at all was found; defaults to
This snippet does not have any templating. You can only specify if you want the min/max price, the separator, and what to return when no price was found.