d
Topic
Pratham Jani Member
Posts:
19
12 days ago

How to check MyApp installed on store or not ?

I'm posting my code can anyone review it please. And let me know if there is modification needed.

  • $DB_shop is a database object that returns shop name from database
  • $GET_shop is a REQUEST object that returns shop name from post/get
      if($DB_shop== $GET_shop)
      {      

         header("location: https://" . $shop . "/admin/apps/example/index.php");
         die;

      }
      else
      {

         $api_key = "xxxxxxxxxxx";
         $scopes = "read_orders,read_products";
         $redirect_uri = "http://example.herokuapp.com/installation/generate_token.php";

         $install_url = "https://" . $shop . "/admin/oauth/authorize?
           client_id=" . $api_key .  "&scope=" . $scopes . "&redirect_uri=" .                                                       
           urlencode($redirect_uri);
 
         header("Location: " . $install_url);
         die();

      }