This article guides you on creating and configuring a website at deco.cx for a storefront using data from VTEX ecommerce platform.
TL;DR: To connect to VTEX you need to change
vtexapp configuration at https://deco.cx/admin/sites/{site}/library?type=apps
Video: To watch the content of this article, click here
Summary
- Prerequisites
- Creating the website
- Setting up the
Public store URL - Connecting to VTEX
- Adding your collections to your website.
- Troubleshooting
Prerequisites
- A deco webiste. Create one for free at https://deco.cx/admin.
- A VTEX account (help).
Creating the website
In case you already have a website at deco.cx, advance to the next section. Follow the steps in this guide otherwise.
Make sure your site was created based on the Storefront-Vtex template below
Setting up the Public store URL
Deco commerce template currently proxies VTEX's own checkout and
my-account services. This means that your final user will NOT be redirected to
any other domain when checking out. For instance, let's say, before any
migration to deco, your store is hosted on www.mystore.com and the checkout
url is https://www.mystore.com/checkout. After migrating to deco, your store
will continue being served on www.mystore.com and your checkout url will still
be https://www.mystore.com/checkout.
Currently, VTEX does not expose its UI services through a public URL on the
internet. For this reason, we need a secondary URL for enabling proxying
checkout and my-account services. Following our example above, create a new
subdomain, let's say proxy.mystore.com and point it to VTEX following this
guide.
After that, the proxy.mystore.com will be the Public store URL required on
the next step
The final architecture of the setup is:
Connecting to VTEX
To connect to your VTEX account:
Access your site's administrative panel at https://deco.cx/admin.
On the topbar, select blocks
Choose the Apps tab
Select the vtex app. You should see something like:
Change the account configuration from
bravtexfashionstoreto your VTEX account nameSet the
Public store URL.Click on
Saveand thenPublish.
🎉 Congratulations, you have setup the VTEX integration. To ensure the integration is working properly, keep reading and create a reuseable collection block.
Adding your collections to your website.
After the VTEX setup is complete, try adding a shelf to your webiste.
Access your site's administrative panel at https://deco.cx/admin.
On the topbar, select blocks
Select the block
/Products/ProductShelf.tsxand click on the+buttonOn the
productsfield, select any VTEX integration (legacy or Intelligent Search).Fill the
Collection IDwith a valid collection, e.g. 139Fill the
countattribute with the number of products to display, let's say 6.Now, on the top right corner, click on
Createand name it, e.g.Collection 139On the top right corner click on
Publish.You can now drag&drop the block
Collection 139in any page.
Troubleshooting
Common issues when connecting to VTEX arises from:
VTEX Intelligent Search (IS) is not installed on the account If you are not sure IS is installed in your account, please use the traditional (VTEX Catalog) loaders. Beware some features of Fashion starter like autocomplete depend on Intelligent Search.
Wrong salesChannel/defaultLocale setup. Setting up the wrong salesChannel/defaultLocale may lead to the wrong products/prices being displayed. To find the correct values:
- With Dev Tools open, go to Application or Storage.
- On the left side, select the Cookies item and select the store's URL.
- Look for Cookie
vtex_segmentand copy its value,. - Go to the https://jwt.io website and paste the value.
- Check the returned JSON. The
channelfield brings thesalesChannelvalue and thecultureInfofield brings thedefaultLocale.
In most cases the
salesChannelis 1
Wrong accountName setup. To figure out the right accountName:
- Access your current store URL, e.g.: https://www.mystore.com.br.
- Right-click and select Inspect.
- With Dev Tools open, type Ctrl + F to open the search within the HTML.
- Search for
vtexassetsorvteximg(depending on the store's current CMS). - The
accountNamewill be in URLs in the format:{accountName}.vtexassets.comor{accountName}.vteximg.com.br.
