Retrieve multiple fields from product with lowest price from products TV

If I have a resource with a products TV (with multiple products linked) and I want to retrieve separate fields, but only from the product with the lowest price, how would I do that?

I know I could do something like this:

[[!commerce.get_products? &products=`[[*products]]` &tpl=`product.price` &limit=`1` &sortby=`price`]]

// product.price chunk
[[+price_rendered]]

But this seems a bit much to have for each individual field…

I basically need the get_product snippet, but with a &sortby parameter so I can still make use of the toPlaceholder property but without being stuck to the very first product in the TV.

Is there any other solution for this?

The next release (1.3.0-rc9 or 1.3.0-pl) will have a &sortby property on the commerce.get_product snippet for you. Already have most of it coded, but need a bit more time to test and document the change before making that available.

1 Like