The block object
A block
represents the content and settings of a single block in an array of section blocks. Sections and blocks are reusable modules of content that make up JSON templates.
The block
object can be accessed in a section file by looping through section.blocks
.
The block
object has the following attributes:
Returns a unique ID dynamically generated by Shopify.
block.settings
Anchor link to section titled "block.settings"Returns an object of the block settings set in the theme editor. Retrieve setting
values by referencing the setting's unique id
.
block.shopify_attributes
Anchor link to section titled "block.shopify_attributes"Returns a string representing the block's attributes.
The theme editor's JavaScript API uses a block's shopify_attributes
to identify blocks and listen for events. No value for block.shopify_attributes
is returned outside the theme editor.
Returns the type defined in the block's schema. The type is a free-form string that you can use as an identifier. For example, you might display different markup based on the block.type
.