App Review Issue: Redirection to Different Store During Installation Context

Our app submission was rejected during Shopify’s review process with the following feedback:

“During review, we are still unable to integrate our Shopify store due to some issue where the app redirects us to a different store and installs the app again when it’s already installed.”

Questions

  1. How to prevent installation in different stores?
    From our app’s perspective, how can we control or prevent the app from being “installed in a different store”?
  • Are there specific Shopify guidelines for handling multi-store scenarios during review?
  1. Handling “already installed” scenarios
    What should be the expected behavior when the app is already installed in a store?
  • Should we redirect to the app’s main interface?

Additional Context

Currently, I use this code to redirect users to install the app:

"https://admin.shopify.com/admin/oauth/authorize?client_id={$client_id}&scope={$scope}&redirect_uri={$redirect_uri}&state={$state}"

I understand that I should use:

"https://{$shop}.myshopify.com/admin/oauth/authorize?client_id={$client_id}&scope={$scope}&redirect_uri={$redirect_uri}&state={$state}"

However, my main question is: How am I supposed to obtain the $shop parameter?

According to Shopify’s app requirements, we should never ask users to manually enter their store name. But then:

  • Where does the shop parameter come from initially?

This seems to be the root cause of the redirection issue reported by the reviewer.

I’m using Laravel to implement this functionality.

The first request to your app will contain different query parameters. One of these is a shop parameter.