How to get section id within the same pag

I have 2 sections that are included on the same page, and in section 1, I have a button that I want to set the href to #section_2.

It works if I manually paste the dynamically generated section id of section 2 as href, but it seems that shopify would dynamically generate this id and it might change (not sure when it would regenerate), which will break this functionality.

Therefore, I am looking for a way to get the dynamically generated section id programmatically and pass that as the href to avoid potential breakage.

Thanks

Hi @Alexweee

Shopify automatically generates an ID each time you create a new section. But you can customize the liquid code of the section and wrap all the code of into your dynamically ID


// code of your section' file