I developed a complex application for a client that has a back-end configuration and some front-end code with which users interact.
The back-end configuration area does the following things:
- interacts with their own API to pull in data as a table;
- creates product options (sizes) based on API data;
- assign images, descriptions, and other information to products.
The front-end does the following things:
- uses ScriptTag API to show a tabular section above the footer;
- updates the way product sizes are displayed;
- updates the way product cart items are displayed (eg. show different cart item images if certain conditions are met);
- updates the way orders are displayed in the customer account section (eg. if certain conditions are met, some text/image is added).
All of these front-end changes are performed using ScriptTag API which causes problems because the content is rendered after the page loads. To give you an example, on the product page, the default way of showing sizes is visible when the page loads and after a few seconds, after our script loads, the changes are applied.
Also, we have a hard time making the app compatible with multiple themes because this extension will be used on various themes. We do some DOM selections that might work on one theme, but not on other ones because those selectors don't exist.
That's why I opened this thread because I want to find the best possible option to avoid all these problems as much as we can. I am thinking of switching to the Asset API approach, but also trying to limit our involvement in adding/removing code if the app is uninstalled.
What are your thoughts about this situation?
Is it better to continuously use ScriptTag API, but maybe involving some conditional rendering within this process or is it better to switch sides and go for the Asset API approach?
Looking forward to hearing back from you.