Skip to content

Commit

Permalink
show variant products if it's the only variant
Browse files Browse the repository at this point in the history
  • Loading branch information
AidasK authored Oct 20, 2024
1 parent a39a34f commit 311a5fe
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/admin/src/Filament/Resources/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static function getWidgets(): array
public static function getDefaultForm(Form $form): Form
{
return $form
->schema([
->schema(fn (Product $record) => [
Shout::make('product-status')
->content(
__('lunarpanel::product.status.unpublished.content')
Expand All @@ -123,6 +123,19 @@ public static function getDefaultForm(Form $form): Form
static::getMainFormComponents(),
),
static::getAttributeDataFormComponent(),
...(
$record->variants->count() === 1 ?
[Forms\Components\Repeater::make('variants')
->relationship()
->schema([
Attributes::make()->statePath('attribute_data')
])
->maxItems(1)
->addable(false)
->deletable(false)
->label('Variant details')] :
[]
)
])
->columns(1);
}
Expand Down

0 comments on commit 311a5fe

Please sign in to comment.