Hi, I am trying to build an app that will modify the layout of a user's existing theme.
Functionally I believe it has a lot in common with the the free shipping bar apps as I basically need to know when there is something in their shopping cart and also know how much their current cart total is.
Looking through the documentation, there seems to be 2 alternatives:
1) I can use the Theme API to get the current theme and the Asset APIs to alter it. If I do this, how do I insert a piece of code to the existing theme? do I actually have to make a copy of the liquid file and then manually inject the extra html code? there doesn't seem to be a way to target a specific id or class and insert my html through the asset API.
2) I can use a script tag + webhooks to get cart data. One of the negatives to this solution is the webhooks have a bit of a delay.
Is there one that is considered best practice?
Thanks in advance!
Solved! Go to the solution
This is an accepted solution.
I've found this article to be very insightful into the different methods of altering the storefront with an app. It also discusses the downsides of the different methods.
Maybe you find it helpful as well.