Add WooCommerce-style featured image and product gallery flow.
Deploy Ladill Woo Manager / deploy (push) Successful in 24s

Sync full image sets through the plugin, with upload/URL support in the product editor and thumbnails in the list.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-07 00:27:11 +00:00
co-authored by Cursor
parent e3ef23218f
commit 085645fd0f
10 changed files with 434 additions and 67 deletions
+46
View File
@@ -283,6 +283,52 @@ class WooWebTest extends TestCase
$this->assertDatabaseHas('woo_orders', ['external_order_id' => 99]);
}
public function test_product_webhook_ingests_gallery_images(): 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' => 102,
'name' => 'Gallery Hoodie',
'slug' => 'gallery-hoodie',
'status' => 'publish',
'regular_price' => '150.00',
'images' => [
['id' => 1, 'src' => 'https://shop.example.com/featured.jpg', 'alt' => 'Front', 'position' => 0],
['id' => 2, 'src' => 'https://shop.example.com/gallery-1.jpg', 'alt' => 'Side', 'position' => 1],
['id' => 3, 'src' => 'https://shop.example.com/gallery-2.jpg', 'alt' => 'Back', 'position' => 2],
],
];
$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();
$product = \App\Models\WooProduct::query()->where('external_id', 102)->first();
$this->assertNotNull($product);
$this->assertSame('https://shop.example.com/featured.jpg', $product->featuredImage()['src'] ?? null);
$this->assertCount(2, $product->galleryImages());
}
public function test_merchant_can_view_products_page(): void
{
$user = User::factory()->create();