Feat: Adding Purchasable to 'in_stock' when importing a new product
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user