Documentation
Feedback
Guides
Storefront Development

Storefront Development
Store Framework
Overriding native app blocks

Discover how to override the blocks of your custom VTEX IO app.

In this guide, you'll learn how to override the blocks provided by a native VTEX IO app with a custom app by configuring the store/plugins.json file. This approach allows custom apps to modify existing Store Framework blocks without changing the original app's code.

This is especially useful when you need to customize a page or component while maintaining compatibility with future updates of the original app. Follow the steps below to ensure your custom app works properly with existing dependencies and block schemas.

Before you begin

Develop your VTEX IO custom app

Start the development of a new VTEX IO app by running the vtex init command and choosing the appropriate template. Learn more in the tutorial Storefront apps.

Use a development workspace to develop you custom app.

Check the builders

Configure the following builders in the app's manifest.json file:

  • store builder: Enables the development of Store Framework storefronts.
  • react builder: Used to develop apps with React when your project requires customized frontend solutions.

Instructions

Step 1 - Managing dependencies

Add the corresponding native VTEX IO app as a dependency in the custom app's manifest.json file.

manifest.json/dependencies

_10
"dependencies": {
_10
"vtex.original-app": "1.x"
_10
}

Step 2 - Defining the app's schema

  1. In your app's root directory, create the store folder.
  2. In the store folder, create the interfaces.json file and define the app's schema by following the original native app. For example, if the native app block has example-child as required, the new block must also declare it:

_10
"new-block": {
_10
"component": "NewBlock"
_10
"required": ['example-child']
_10
}

Step 3 - Configuring plugins

In the store folder, create the plugins.json file within the key-value pairs of the blocks you want to override.

store/plugins.json

_10
{
_10
"original-block": "new-block"
_10
}

Step 4 - Customizing your app code

Declare the React component for your new block. In the example below, we added the greeting HELLO WORLD.

NewBlock.js

_10
import React from 'react'
_10
_10
const NewBlock: React.FC = () => {
_10
return <h1>HELLO WORLD</h1>
_10
}
_10
_10
export default NewBlock

Step 5 - Testing your custom app

Link the app in the development workspace you're working in to see the changes.

Based on the given example, you'll see the following page when placing an order:

{"base64":"  ","img":{"width":1999,"height":1096,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":223223,"url":"https://cdn.jsdelivr.net/gh/vtexdocs/dev-portal-content@main/docs/guides/vtex-io/Storefront-Guides/images/overriding-blocks.png"}}

Step 6 - Making your app publicly available

Once you finish developing and testing your custom app, deploy it to make it available in the live store. Learn how in the guide Deploying a new app version.

Contributors
1
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
1
Photo of the contributor
On this page