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

Solved
zainsan152
New Member
3 0 0

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?

 

// 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();
0 Likes
Jayvin
Shopify Partner
162 24 34

This is an accepted solution.

Hi,

When a merchant installs your app from the shopify store, ?shop querystring parameter will be automatically added by shopify.

0 Likes