Created
October 30, 2019 06:16
-
-
Save Cam/8679e020150dc7dc3b2e173753082f9d to your computer and use it in GitHub Desktop.
Get properties from global objects in liquid for Shopify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- assign object = block.settings.url -%} | |
{%- if object -%} | |
{%- if object.type == 'page_link' -%} | |
{%- assign object = block.settings[link] | remove: '/pages/' -%} | |
{%- assign title = pages[object].title -%} | |
{%- elsif object.type == 'collection_link' -%} | |
{%- assign object = block.settings[link] | remove: '/collections/' -%} | |
{%- assign title = collections[object].title -%} | |
{%- elsif object.type == 'product_link' -%} | |
{%- assign object = block.settings[link] | remove: '/products/' -%} | |
{%- assign title = all_products[object].title -%} | |
{%- elsif object.type == 'blog_link' -%} | |
{%- assign object = block.settings[link] | remove: '/blogs/' -%} | |
{%- assign title = blogs[object].title -%} | |
{%- elsif object.type == 'article_link' -%} | |
{%- assign object = block.settings[link] | remove: '/blogs/' -%} | |
{%- assign title = articles[object].title -%} | |
{%- elsif object.type == 'policy_link' -%} | |
{%- assign object = block.settings[link] | remove: '/policies/' | replace: '-', '_' -%} | |
{%- assign title = shop[object].title -%} | |
{%- endif -%} | |
{%- endif -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment