Theme blocks "closest.<type>" not working as expected

Hey Guys!

I hope you are doing well :slight_smile:
So i played around with the new theme blocks and its amazing! I really like the concept.

I came across one problem though. There is the “Dynamic sources” tab in the block documentation (Dynamic sources)

There the documentation mentions how you can use dynamic data to define ahead of time where data will come from.
For example you wanna display a product.title. Is the data from a product on template level or from a product defined in a section/block setting? You can define this by using “closest.”, in my case “closest.product”.

But as im using {{ closest.product }} it tells me, that the “closest” object is undefined?

In the parent section i did this:

{% content_for 'blocks', closest.product: product %}

And in the block i did this:

{{ closest.product.title }}

Why is this not working? Am i missing a crucial part of understanding this concept? Or is it not fully worked out yet?

Thanks for your replies!

Hey Bosidev!

Great to see you’re enjoying testing out theme blocks - have connected with the team that own this and will report back asap!

1 Like

Hello there,

Thanks for calling this out. We’re working on updating the documentation but currently {{ closest.<type> }} can only be used as a setting configuration. closest is not currently directly accessible in liquid, but you will be able to reference theme block settings instead of preset or config data.

Sorry for the confusion! Hope this response helps!

Thanks @Liam-Shopify and @r_jur !

Got it!
But yeah, the documentation indicates to me, that i can use closest. as an actual object, when given down by templates/sections/blocks.