Approach for App Blocks with multiple connected third-party accounts?

Approach for App Blocks with multiple connected third-party accounts?

james-riley
Shopify Partner
2 0 1

Hello, we have an app in the Shopify app store, where multiple accounts on our platform can be connected to the same Shopify store. Among other features, our app provides Theme and App blocks for the Shopify User to use within their store. Our question relates to how best to assign or declare which account is being used on the Shopify store.

 

Is there a suitable approach to having it so that the Shopify store is aware of the account ID in use, which can then be used in e.g building a JS embed script that the Theme block outputs?

 

To clarify, a Shopify store e.g 'shoes.myshopify.com' may have two accounts on our platform:

 

@leathershoes with ID#123
@casualshoes with ID#456

 

Both of these independent accounts can Oauth authenticate with the same Shopify store (where we e.g retrieve a list of products from the Shopify store). But on the Shopify store, when a Theme block is used, and an embed code is generated, we need a way to reliably determine which of the two accounts is being used. This is to prevent an undesired 'collision', where an embed code is rendered in the Shopify store for the wrong account.

 

The best way to determine an account on our platform, is via its ID (e.g 123), and so we'd like to provide a way for the Shopify store to persist this as a setting, so that it can be used (interpolated) into the rendered Theme block, so that a script is rendered in the format e.g: <script src="https://ourplatform.com/123/gallery.js">.

 

In achieving this, we'd also like to be able to keep the UX for the User is as simple as possible. I assume this scenario (of multiple partner accounts being connected to the same Shopify store), is one that is common, and thus to save re-inventing the wheel, we'd really appreciate some pointers as to how to achieve this.

Replies 0 (0)