From c0ae9d899643fdbad48487ca043bbe374af18034 Mon Sep 17 00:00:00 2001 From: Konstantinos Arvanitakis Date: Tue, 22 Sep 2026 13:48:08 +0300 Subject: [PATCH] Feat: Adding Purchasable to 'in_stock' when importing a new product --- src/MigrateImport/Shopify/ShopifyExportImporter.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/MigrateImport/Shopify/ShopifyExportImporter.php b/src/MigrateImport/Shopify/ShopifyExportImporter.php index 72ae6ce..5032233 100644 --- a/src/MigrateImport/Shopify/ShopifyExportImporter.php +++ b/src/MigrateImport/Shopify/ShopifyExportImporter.php @@ -163,6 +163,12 @@ class ShopifyExportImporter implements Importer $variant->sku = trim((string) ($row['Variant SKU'] ?? '')) ?: null; $variant->stock = (int) ($row['Variant Inventory Qty'] ?? 0); $variant->shippable = filter_var($row['Variant Requires Shipping'] ?? 'true', FILTER_VALIDATE_BOOLEAN); + // Lunar's own column default is 'always' (purchasable regardless of + // stock) — wrong for an imported catalogue, whose Variant Inventory + // Qty is real, meaningful stock data. 'in_stock' makes purchasability + // actually respect it (see Modules\Core\Catalog\Services\ + // StockService's own docblock on the three purchasable values). + $variant->purchasable = 'in_stock'; $variant->save(); ImportMapping::record(self::SOURCE, 'variant', $externalId, $variant);