In this article, we will learn about how to manage app block in the Shopify theme app extension in the Shopify remix app.
A theme app extension is a bundle of app blocks, app embed blocks, assets, and snippets. Apps that inject inline content on a page extend themes using app blocks. Merchants can add app blocks to a compatible theme section, or as wrapped app blocks that are added at the section level. Create an app block by setting the target in the schema to a section.
By default, themes don’t include app blocks after an app is installed. Merchants need to add the app blocks to the theme from the Apps section of the theme editor.
Contents
Enabled_on: Limit an app block to specific templates and section groups, or limit an app embed block to specific templates.
App blocks and app embed blocks can’t be rendered on checkout step pages.
You can use only one of enabled_on or disabled_on.
Here is the example for enable app block for customers/login page only:
{% schema %} { "name": "Your App Block", "target": "section", "enabled_on":{"templates": ["customers/login"]} "settings": [] } {% endschema %}
You can restrict a section to certain template page types and section group types by specifying them through the enabled_on attribute.
enabled_on, along with disabled_on, replaces the templates attribute. You can use only one of enabled_on or disabled_on.
disabled_on: Prevent app block from being used in specific templates and section groups, or prevent an app embed block from being used in specific templates.
App blocks and app embed blocks can’t be rendered on checkout step pages.
You can use only one of enabled_on or disabled_on.
Here is the example for disable app block for customers/login page only:
{% schema %} { "name": "Your App Block", "target": "section", "disabled_on":{"templates": ["customers/login"]} "settings": [] } {% endschema %}
You can prevent a section from being used on certain template page types and section group types by setting them in the disabled_on attribute. When you use disabled_on, the section is available to all templates and section groups except the ones that you specified. disabled_on along with enabled_on replaces the templates attribute.
Managing App Blocks in Theme App Extensions within the Shopify Remix App is a powerful way to enhance a Shopify store’s functionality. By following the steps outlined in this guide, you can create, deploy, and manage custom App Blocks that give merchants the flexibility to create dynamic and engaging storefronts. Whether you’re a seasoned Shopify developer or just starting, mastering App Blocks will be an invaluable skill in your toolkit.
In today’s digital landscape, web application security is paramount. As a powerful PHP framework, Laravel…
October was an exciting month for MageComp! From significant updates across our Magento 2 extension…
In modern web development, seamless navigation and state management are crucial for delivering a smooth…
Magento Open Source 2.4.8 beta version released on October 8, 2024. The latest release of…
Hello Magento Friends, Creating catalog price rules programmatically in Magento 2 can be a valuable…
As the world of eCommerce continues to thrive, Shopify has become one of the most…