Install Laravel-Shopify Package
composer require osiset/laravel-shopify
After installing above package run this command inside your project root directory.
php artisan vendor:publish --tag=shopify-config
You're now able to access config in config/shopify-app.php
In your app's settings on your Shopify Partner dashboard, you need to set the callback URL to be:
https://(your-domain).com/
And the redirect_uri to be:
https://(your-domain).com/authenticate
The callback URL will point to the home route, while the redirect_uri will point to the authentication route.
NOTE:Those two URLs must start with https, otherwise you will get an error message: "Oauth error invalid_request: The redirect_uri is not whitelisted"
Modify Env File
SHOPIFY_APP_HOST_NAME="(you app host name)"
SHOPIFY_API_KEY="(your api key)"
SHOPIFY_API_SECRET="(your secret token)"
SHOPIFY_API_SCOPES="read_products,write_products,read_themes,write_themes,read_orders,read_customers"
Modify Routing
update routes/web.php file:
Route::get('/', function () {
return view('welcome');
})->middleware(['verify.shopify'])->name('home');
Next, modify resources/views/welcome.blade.php to extend this packages' layout for Shopify AppBridge abilities, example:
@extends('shopify-app::layouts.default')
@section('content')
<!-- You are: (shop domain name) -->
<p>You are: {{ $shopDomain ?? Auth::user()->name }}</p>
@endsection
@section('scripts')
@parent
<script>
actions.TitleBar.create(app, { title: 'Welcome' });
</script>
@endsection
Top comments (0)