Storing and retrieving data for custom Shopify apps

luiquao
Tourist
4 0 1

So I am trying to build something for my store but a few basic things are somewhat unclear.

  1. If I need to save some user settings do I need my own backend just for that app specifically? For simplicity sake, I want build an app to save and display a custom message in cart-template.liquid. To achieve that, my app should make a request to my backend (lets say, on heroku) and save it in some db that app is using.

  2. How do I retrieve that data in cart-template.liquid? I guess I build a snippet that calls a public endpoint of my backend that returns that saved message using fetch() or maybe axios.get and embed it using {% render 'fetch-custom-message-snippet' %} ?

  3. Say I ask for user input, ie. "Engraved message" and the form is in cart-template.liquid, of course. The following snippet is used:

    <p class="line-item-property__field">
      <label for="engraved-message">Engraved message</label>
      <input id="engraved-message" type="text" name="properties[Engraved message]">
    </p>

    How do I make sure that bit of information is captured and passed to me? I guess I want to see it somewhere in the order details.