Add Shopify inventory sync and order webhook
Deploy / deploy (push) Successful in 14s

- Migration: shopify_variant_id on products_sizes, shopify_order_id on products_sales
- ShopifyService: paginated REST client (2024-10 API)
- shopify:map — one-time command to link variants by SKU
- shopify:sync — reconciliation command (Shopify is master)
- VerifyShopifyWebhook middleware: HMAC-SHA256 verification
- ShopifyWebhookController: idempotent orders/paid handler, FIFO inventory deduction
- Webhook route: POST /api/webhooks/shopify/orders-paid

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Malek Tellissi
2026-09-11 02:53:49 +02:00
co-authored by Claude Sonnet 4.6
parent f54b471848
commit 467d85dfec
11 changed files with 349 additions and 1 deletions
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('products_sizes', function (Blueprint $table) {
$table->string('shopify_variant_id')->nullable()->unique()->after('sku');
});
Schema::table('products_sales', function (Blueprint $table) {
$table->string('shopify_order_id')->nullable()->after('sold_at');
$table->index('shopify_order_id');
});
}
public function down(): void
{
Schema::table('products_sales', function (Blueprint $table) {
$table->dropIndex(['shopify_order_id']);
$table->dropColumn('shopify_order_id');
});
Schema::table('products_sizes', function (Blueprint $table) {
$table->dropUnique(['shopify_variant_id']);
$table->dropColumn('shopify_variant_id');
});
}
};