# Issue with Empty SELECT Custom Field in Shopware 6

**URL:** https://forum.shopware.com/t/issue-with-empty-select-custom-field-in-shopware-6/100848
**Category:** Programming (EN)
**Tags:** general, programming
**Created:** [14. August 2023 um 00:21 UTC](https://forum.shopware.com/t/issue-with-empty-select-custom-field-in-shopware-6/100848 "2023-08-14T00:21:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![husseinahk92](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/husseinahk92/32/21524_2.png) [@husseinahk92](https://forum.shopware.com/u/husseinahk92)
#### Post date: [14. August 2023 um 00:21 UTC](https://forum.shopware.com/t/issue-with-empty-select-custom-field-in-shopware-6/100848/1 "2023-08-14T00:21:15Z")

</div>

I’m facing an issue while creating a custom SELECT field in Shopware 6 using a plugin. The custom field is being created successfully, but when I attempt to use the SELECT field in the category settings, the dropdown options appear empty. Instead of showing the expected „ON“ and „OFF“ options, the dropdown displays two empty values.

```auto
<?php declare(strict_types=1);

namespace MyNameSpace;

use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\System\CustomField\CustomFieldTypes;
use Shopware\Core\Defaults;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;

class MyClass extends Plugin
{
    public function activate(ActivateContext $activateContext): void
    {
        parent::activate($activateContext);
        
        $context = $activateContext->getContext();
        $this->createCustomField($context);
    }

    private function createCustomField(Context $context): void
    {
        $customFieldRepository = $this->container->get('custom_field_set.repository');

        $customFieldData = [
            'name' => 'categoryNoteSet',
            'config' => [
                'label' => [
                    'en-GB' => 'Categories Notes',
                    'de-DE' => 'Kategorien Hinweise',
                    Defaults::LANGUAGE_SYSTEM => "Categories Notes"
                ]
            ],
            'relations' => [
                [
                   'entityName' => 'category'
                ]
            ],
            'customFields' => [
                // ... Other custom fields
                [
                    'name' => 'noteOfferActivate',
                    'type' => CustomFieldTypes::SELECT,
                    'config' => [
                        'label' => [
                            'en-GB' => 'Activate Offer note',
                            'de-DE' => 'Angebot Hinweis aktivieren',
                            Defaults::LANGUAGE_SYSTEM => "Note Text"
                        ],
                        'options' => [
                            [
                                'label' => [
                                    'en-GB' => 'ON',
                                    'de-DE' => 'An',
                                ],
                                'value' => 'true',
                            ],
                            [
                                'label' => [
                                    'en-GB' => 'OFF',
                                    'de-DE' => 'Aus',
                                ],
                                'value' => 'false',
                            ]               
                        ],
                        'customFieldPosition' => 5
                    ]
                ],
                // ... Other custom fields
            ]
        ];

        $customFieldRepository->create([$customFieldData], $context);
    }
}

```

that’s how it looks:

 ![Screenshot 2023-08-14 021221](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/c/b/cbfe9a25c6c99ec7a133a6b8c40be2e50bc155fd.png)

**Problem Details:**

- I’m creating a custom SELECT field in Shopware 6 using the provided code.
- The custom field creation is successful with two options: „ON“ and „OFF.“
- However, upon accessing category settings, the dropdown field for the SELECT option displays two empty values instead of the expected „ON“ and „OFF“ options.

I would greatly appreciate any assistance or guidance on how to resolve this issue. Thank you for your support!

---

<div class="post-metadata">

### Author: ![Srcaft](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Srcaft](https://forum.shopware.com/u/Srcaft)
#### Post date: [23. August 2023 um 09:17 UTC](https://forum.shopware.com/t/issue-with-empty-select-custom-field-in-shopware-6/100848/2 "2023-08-23T09:17:56Z")

</div>

I have exactly the same issue. So far I haven’t found a solution.

---

<div class="post-metadata">

### Author: ![husseinahk92](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/husseinahk92/32/21524_2.png) [@husseinahk92](https://forum.shopware.com/u/husseinahk92)
#### Post date: [23. August 2023 um 10:48 UTC](https://forum.shopware.com/t/issue-with-empty-select-custom-field-in-shopware-6/100848/3 "2023-08-23T10:48:59Z")

</div>

Hey @Srcaft, i found the solution, just add the componentName in config like this:

```auto
[
    // ...
    'config' => [
        // ...
        'componentName' => 'sw-single-select',
    ],
]
```
