How to get merchant’s shop name with oauth in shopify?

  php, shopify-api, shopify-app

i’m building shopify public app in php.
I have a question that how can i get merchant’s shop name when he installs my app?

<?php

// Set variables for our request
$shop = ''; // i need merchants shop's name here automatically when he installs app
$api_key = "35cf1c83dd3bd3a9b230d5773fbffa2a";
$scopes = "read_orders,write_products,read_customers,write_customers";
$redirect_uri = "https://app.stockkonnect.co/php-shopify-app/generate_token.php";

// Build install/approval URL to redirect to
$install_url = "https://" . $shop . ".myshopify.com/admin/oauth/authorize?client_id=" . $api_key . "&scope=" . $scopes . "&redirect_uri=" . ($redirect_uri);

// Redirect
header("Location: " . $install_url);
die();

Source: Ask PHP

LEAVE A COMMENT