Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
We have an app that helps our client stores embed some interactive widgets on their Shopify stores. The way this widget works is that the outer level components of the widget are extremely light weight and require very less data to function. But once the user clicks on the widget, we open up a full screen interaction overlay, which requires a bunch of data which we currently store and fetch from metafiels.
Currently, since our app offers a theme app extension to add this widget block, we are pulling all this data through liquid in one go. The problem is because this data is too huge and most of this data is not used anyways (for people who do not interact with our widget), the initial server response times are doubling after installing our app.
A way around this is that in the initial response, we only send over those data that is needed for the outer level widget and only when the user interacts with our widget, make another API call to get the rest of the data.
To do the latter, the Storefront API would have been perfect! But unfortunately, we have found that Storefront API is only accessible to Sales Channel apps. So this leaves us with 2 options:
1. Since we are already live on 60+ clients, we cannot convert our app into a sales channel app. We could build a brand new app, as a sales channel this time. But would this be allowed, if our goal is simply to use the storefront api on the shopify store itself (since from our understanding, sales channel apps were meant to be used on other marketplaces and stuff)?
2. We create our own API which will get the required data from GraphQL API. But this just sounds wasteful to us and less efficient since as the rest of the store assets are coming from Shopify, would just be better to use a Shopify end point if that's available to us.
Is there any other way to do this?
TLDR: Our interactive app (theme app extension) tries to send a lot of data coming from metafields which heavily increases initial server response time as the total response data size from the server is too big. We do not need most of this data in the beginning anyways as this comes into play only when the user first interacts with our app. Storefront API is a solution that would let us get metafield data on the fly, but is only available to sales channel apps.