Skip to content

closest

Objects a section hands down to every theme block inside it.

A section passes them with {% content_for ‘blocks’, closest.product: product %}; any block below, however deep, reads closest.product. Use it so one block (a price, a buy button) works in every section that shows a product.

Available in: Theme blocks.

Property Type Description
closest.product product The product the section is about (when it passes one).
Liquid
{{ closest.product.title | default: 'No product here' }}
Output
No product here

Since theme platform 1.0.

Was this page helpful?