Fix: Small update to label parsing
This commit is contained in:
@@ -16,10 +16,16 @@ class ProductOptionResolver
|
||||
// the same option instead of creating a near-duplicate.
|
||||
$handle = Str::slug($name) ?: 'option';
|
||||
|
||||
// 'label' must be set even though nothing here reads it back — a null
|
||||
// label crashes Lunar's own ProductOptionIndexer::toSearchableArray()
|
||||
// (foreach (null as ...)) the moment this option gets reindexed, since
|
||||
// it assumes every ProductOption always has one. Same value as 'name'
|
||||
// is a reasonable default; Shopify's CSV has no separate "label" concept.
|
||||
return ProductOption::query()->firstOrCreate(
|
||||
['handle' => $handle],
|
||||
[
|
||||
'name' => [DefaultLocale::code() => $name],
|
||||
'label' => [DefaultLocale::code() => $name],
|
||||
'shared' => true,
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user