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
+110
View File
@@ -131,4 +131,114 @@ class WooWebTest extends TestCase
$this->assertSame(WooOrder::FULFILLMENT_PREPARING, $order->fresh()->fulfillment_status);
}
public function test_product_webhook_ingests_product(): void
{
$user = User::factory()->create();
$store = WooStore::create([
'user_id' => $user->id,
'site_url' => 'https://shop.example.com',
'status' => WooStore::STATUS_ACTIVE,
'connected_at' => now(),
]);
$payload = [
'id' => 101,
'name' => 'Hoodie',
'slug' => 'hoodie',
'sku' => 'HD-1',
'status' => 'publish',
'regular_price' => '150.00',
'categories' => [['id' => 12, 'name' => 'Apparel']],
];
$body = json_encode($payload, JSON_THROW_ON_ERROR);
$signature = base64_encode(hash_hmac('sha256', $body, (string) $store->webhook_secret, true));
$this->call(
'POST',
route('woo.webhooks.woocommerce', $store->public_id),
[],
[],
[],
[
'CONTENT_TYPE' => 'application/json',
'HTTP_X_WC_WEBHOOK_SIGNATURE' => $signature,
'HTTP_X_WC_WEBHOOK_TOPIC' => 'product.updated',
],
$body,
)->assertOk();
$this->assertDatabaseHas('woo_products', [
'woo_store_id' => $store->id,
'external_id' => 101,
'name' => 'Hoodie',
'sku' => 'HD-1',
]);
}
public function test_category_webhook_ingests_category(): void
{
$user = User::factory()->create();
$store = WooStore::create([
'user_id' => $user->id,
'site_url' => 'https://shop.example.com',
'status' => WooStore::STATUS_ACTIVE,
'connected_at' => now(),
]);
$payload = [
'id' => 12,
'name' => 'Apparel',
'slug' => 'apparel',
'parent' => 0,
'count' => 4,
];
$body = json_encode($payload, JSON_THROW_ON_ERROR);
$signature = base64_encode(hash_hmac('sha256', $body, (string) $store->webhook_secret, true));
$this->call(
'POST',
route('woo.webhooks.woocommerce', $store->public_id),
[],
[],
[],
[
'CONTENT_TYPE' => 'application/json',
'HTTP_X_WC_WEBHOOK_SIGNATURE' => $signature,
'HTTP_X_WC_WEBHOOK_TOPIC' => 'product_category.created',
],
$body,
)->assertOk();
$this->assertDatabaseHas('woo_categories', [
'woo_store_id' => $store->id,
'external_id' => 12,
'name' => 'Apparel',
]);
}
public function test_merchant_can_view_products_page(): void
{
$user = User::factory()->create();
$store = WooStore::create([
'user_id' => $user->id,
'site_url' => 'https://shop.example.com',
'status' => WooStore::STATUS_ACTIVE,
]);
\App\Models\WooProduct::create([
'woo_store_id' => $store->id,
'external_id' => 1,
'name' => 'Sample Tee',
'slug' => 'sample-tee',
'status' => 'publish',
]);
$this->actingAs($user)
->get(route('woo.products.index'))
->assertOk()
->assertSee('Sample Tee');
}
}