Fix: Small update to label parsing

This commit is contained in:
2026-09-03 13:22:09 +03:00
parent f43f72f633
commit 6963515971
3 changed files with 158 additions and 0 deletions
@@ -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,
],
);