SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH SPECIAL OFFER: ENJOY 3 MONTHS OF SHOPIFY FOR $1/MONTH
shopify app laravel

How to connect laravel with shopify for developers ?

First create a project and install valet in this article . https://magepow.com/blog/how-to-install-a-laravel-valet-in-windows-10/

once you have reached your laravel folder download the module that handles the connection to the Shopify app themes by opening the command prompt and entering

Read more for more details

composer require osiset/laravel-shopify

php artisan vendor:publish --tag=shopify-config

After installing the Shopify connection pack, please edit the following files

laravel-project\routes\web.php

Route::get('/', function () {
    return view('welcome');
})->middleware(['verify.shopify'])->name('home');

laravel-project\ resources\views\welcome.blade.php

@extends('shopify-app::layouts.default')

@section('content')
    <!-- You are: (shop domain name) -->
    <p>You are: {{ $shopDomain ?? Auth::user()->name }}</p>
    <div id="root"></div>
@endsection

@section('scripts')
    @parent
    <script src="{{asset('js/app.js')}}"></script>
    <script>
        actions.TitleBar.create(app, { title: 'Welcome' });
    </script>
@endsection

laravel-project \app\Models\User.php

Open the file, add after the namespace:

use Osiset\ShopifyApp\Contracts\ShopModel as IShopModel;
use Osiset\ShopifyApp\Traits\ShopModel;

Next, modify the class line to become:

class User extends Authenticatable implements IShopModel

Next, inside the class, add:

use ShopModel;

A completed example:

<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Osiset\ShopifyApp\Contracts\ShopModel as IShopModel;
use Osiset\ShopifyApp\Traits\ShopModel;

class User extends Authenticatable implements IShopModel
{
    use HasApiTokens, HasFactory, Notifiable;
    use ShopModel;
    /**
     * The attributes that are mass assignable.
     *
     * @var string[]
     */
    protected $fillable = [
        'name',
        'email',
        'password',
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var array
     */
    protected $hidden = [
        'password',
        'remember_token',
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}

then open phpmyadmin

due to your use of valet and previous configuration changes at https://magepow.com/blog/how-to-install-a-laravel-valet-in-windows-10/ then go to phpmyadmin folder in xampp folder which you installed earlier in your drive and open command runner run following 2 commands

valet park
valet link

now the path to your PHPMyAdmin is http:\\phpmyadmin.test

you can add and change the PHPMyAdmin login password through this article

after successful login PHPMyAdmin add a new database named laravel_project. Then go back to your laravel folder and change the .env file

DB_DATABASE=laravel_project
DB_USERNAME=root
DB_PASSWORD=yourpass

find and edit these elements in the file to match your PHPMyAdmin connection.

next, run the command.

php artisan migrate

CSRF

You must disable CSRF as there is currently no solution for verifying session tokens with CSRF, there is a conflict due to new login creation each request.

Open \App\Http\Middleware\VerifyCsrfToken.php, and add or edit:

protected $except = [
    '*',
];

Once done, log in to this link

After login select app > Create app select the type of application you want to create. Find more information about the application through the article links contained there.

connection information in the form

Shopify App

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”

After creating the app an API key will be created, add them to the .env or config/shopify-app.php file

SHOPIFY_API_KEY=d1425c9ef2ef1509e43baaf40de74317
SHOPIFY_API_SECRET=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

by adding API key through 2 added variables SHOPIFY_API_KEY and SHOPIFY_API_SECRET they will authenticate that connecting to your laravel folder

Once done, click Select Store A table will appear, hover the mouse pointer over the project app you just created, and press install app. wait a few seconds for Shopify to authenticate if successful an Install app panel is displayed. Click the Install app to continue the installation

and the results are printed out after the job is completed, wish you success