This is the early access documentation preview for Custom Views. This documentation might not be in sync with our official documentation.

Deploying to Render

This deployment example refers to Render.

Prerequisites

Before you get started, you need to have:

Configuration

In your Custom View config, provide the Custom View ID you got when you configured the Custom View in the Merchant Center.

Moreover, you need to provide the production URL from your Render site. You can keep the standard Render URL https://<site>.onrender.com or provide your custom domain.

custom-view-config.jsonjson
{
"env": {
"production": {
"customViewId": "ckvtahxl90097sys6har1e6n3",
"url": "https://<site>.onrender.com"
}
}
}

Using environment variables

In case you want to avoid hardcoding certain values, for example the Custom View ID, or the Project key, you can use variable placeholders in your Custom View config.

custom-view-config.jsonjson
{
"env": {
"production": {
"customViewId": "${env:CUSTOM_VIEW_ID}",
"url": "https://<site>.onrender.com"
}
}
}

Connect Render with GitHub

The easiest way to deploy to Render is to use the GitHub integration.

Follow the steps in Render to create a new static site and import a new Git repository.

Make sure to also install the Render GitHub App to grant access to your repository.

Configuring build settings

In the Render setup process you need to configure the following things:

  • Override the Build command with: yarn build.

    In your package.json make sure to have the following scripts defined:

    package.jsonjson
    {
    "scripts": {
    "build": "mc-scripts build"
    }
    }
  • Override the Publish directory with: public.

  • If possible, select or specify the Node.js Version. Recommended version is >= v18.

If your Custom View config requires environment variables, make sure to provide them in your Render site > Environment.

Configuring rewrite rules

A Custom View is a Single-Page Application that uses client-side routing. Therefore, we need to instruct Render to rewrite all requests to serve the index.html.

/* --> /index.html

Test your deployment

In the Merchant Center you can now follow the steps to install the Custom View and access it in your Projects.

The Custom View won't render if you try to access it directly via the deployment URL, as it needs to be served within the Merchant Center Proxy Router.

Therefore, Preview deployments are not really useful. If you are interested in this functionality, let us know and open a support issue.