Ecwid e-commerce JS code

Hello! My name is Adria, I’m from Ecwid customer service. One of our clients experiences difficulties with adding the Ecwid code to his website and we want to consult with you on it.

Ecwid - an e-commerce platform for merchants to sell online - is made on JavaScript. As I see, it’s possible to add JS codes to Wappler websites with the help of the DMX App Connect with JavaScript Functions and as understand, our mutual client used it for adding Ecwid to his website www.exmooraccountancy.co.uk/store.

The thing is that on the content page above, the Ecwid store snippet does not display, although on the page www.exmooraccountancy.co.uk/shop.php it appears exactly as expected.

Here is what the client himself says about it:

The tool I use is indeed Wappler but all this does is produce standard code and so is effectively the same as hand coding a webpage. This site is a Single Page Application site, in which there is a master page index.php an on it are gaps that get filled in from sub pages of content as required. So index.php is loaded once and the content sections are called in depending on which navigation button the viewer clicks. It works well for all my content pages for example www.exmooraccountancy.co.uk/about

When I set up a new content page for the ECWID shop snippet the snippet does not show although the page works perfectly in every other respect, see www.exmooraccountancy.co.uk/store

I have checked carefully and can see the ECWID code snippet there on this content page. It would seem that for some reason the ECWID code will not run if it is placed on a content page that is called into the master page index.php

Just in case, here is the example of the code that we offer to be inserted to custom-built websites for adding an Ecwid store there. 1003 should be replaced with the store ID of a certain Ecwid store. It helps us to differentiate multiple stores in our system:

    <div id="my-store-1003"></div>
    <div>
    <script data-cfasync="false" type="text/javascript" src="https://app.ecwid.com/script.js?1003&data_platform=code" charset="utf-8"></script><script type="text/javascript"> xProductBrowser("id=my-store-1003");</script>
    </div>

The client also informed us that earlier he tried to add Shopify’s JS code in the same way and that did not work as well. He told us that it was a code snippet like we offer and so he suspects the problem is connected to the way that SPA content pages are interpreted.

So our client and I have the following questions:

Hey Adria,
So do these scripts need to run on page load?

<div id="my-store-1003"></div>
    <div>
        <script data-cfasync="false" type="text/javascript" src="https://app.ecwid.com/script.js?1003&data_platform=code" charset="utf-8"></script>
        <script type="text/javascript"> xProductBrowser("id=my-store-1003");</script>
    </div>

Is this value 1003 a dynamic value or is it all static?

Hello! Thank you for reply!

Yes, Ecwid appears on a website after all other elements and scripts of a site has loaded.

1003 is a static value.