Subscription - Where to Save Type - as effects UI

Shopify Partner
11 1 1


I'm building a Shopify app.

I've got the mutation to create the subscription and all looks ok. However depending on the subscription, certain fields are restricted in the UI.

My question is where can I save that information so I can easily/quickly reference it. I'm thinking of in local storage or a cookie. However my concern is if that was removed or tampered with, I'd need additionally logic to handle those situations.

FYI - I've used the mutation querys from this page:  

I guess this is a common situation so already an easy way to handle - what have people here done?

I was thinking is it possible to attach the the session cookie so its always there as long as the user is logged in.


Replies 2 (2)

Shopify Partner
11 1 1

I've found a potential way, however would like feedback on how good of an approach this is.

So that tutorial uses Koa - in that middle, for each request I could just check - like so:


server.use(async (ctx, next) => {
   console.log('Check if cookie with subscription exists, if not make a call to get')
   await next()
Of course, this doesn't help with some tampering the cookie.
I'm having the feeling I need to add this logic into the backend.
51 12 19

Could you achieve what you want by writing the data to a shop metafield?