Add WooCommerce product and category management.
Deploy Ladill Woo Manager / deploy (push) Successful in 55s

Sync catalog via plugin webhooks and REST proxy, with list/create/edit UI and updated logo from monolith assets.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-06 23:40:14 +00:00
co-authored by Cursor
parent 2a79f0fcca
commit e4b6c2c1ba
24 changed files with 1593 additions and 31 deletions
+51 -2
View File
@@ -3,7 +3,9 @@
namespace App\Http\Controllers;
use App\Models\WooStore;
use App\Services\Woo\CategoryIngestService;
use App\Services\Woo\OrderIngestService;
use App\Services\Woo\ProductIngestService;
use App\Services\Woo\WooWebhookVerifier;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -12,7 +14,9 @@ class WooWebhookController extends Controller
{
public function __construct(
private WooWebhookVerifier $verifier,
private OrderIngestService $ingest,
private OrderIngestService $orders,
private ProductIngestService $products,
private CategoryIngestService $categories,
) {}
public function __invoke(Request $request, string $storePublicId): JsonResponse
@@ -41,11 +45,56 @@ class WooWebhookController extends Controller
return response()->json(['ignored' => true]);
}
$order = $this->ingest->ingest($store, $payload);
return match (true) {
str_starts_with($topic, 'order.') => $this->handleOrder($store, $payload),
str_starts_with($topic, 'product_category.') => $this->handleCategory($store, $topic, $payload),
str_starts_with($topic, 'product.') => $this->handleProduct($store, $topic, $payload),
default => response()->json(['ignored' => true]),
};
}
/** @param array<string, mixed> $payload */
private function handleOrder(WooStore $store, array $payload): JsonResponse
{
$order = $this->orders->ingest($store, $payload);
return response()->json([
'ok' => true,
'order_id' => $order->id,
]);
}
/** @param array<string, mixed> $payload */
private function handleProduct(WooStore $store, string $topic, array $payload): JsonResponse
{
if ($topic === 'product.deleted') {
$this->products->delete($store, (int) ($payload['id'] ?? 0));
return response()->json(['ok' => true, 'deleted' => true]);
}
$product = $this->products->ingest($store, $payload);
return response()->json([
'ok' => true,
'product_id' => $product->id,
]);
}
/** @param array<string, mixed> $payload */
private function handleCategory(WooStore $store, string $topic, array $payload): JsonResponse
{
if ($topic === 'product_category.deleted') {
$this->categories->delete($store, (int) ($payload['id'] ?? 0));
return response()->json(['ok' => true, 'deleted' => true]);
}
$category = $this->categories->ingest($store, $payload);
return response()->json([
'ok' => true,
'category_id' => $category->id,
]);
}
}