after migration my site, i found one strenge issue that when i saved product it not save,

after debbugging i found that

product has custom option of type file

and Compatible File Extensions is required filed,


how to set it to not required

  • Have someone found real fix for this problem?
    – Mikg
    Sep 9, 2018 at 12:14
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review
    – Jarnail S
    Sep 9, 2018 at 14:51

1 Answer 1


You want to change only in Magento version 2.2 or greater.

Create etc/adminhtml/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\CustomOptions" type="vendor\module\Ui\DataProvider\Product\Form\Modifier\CustomOptions" />

Please overwrite CustomOptions.php in your vendor/module/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php

And find getFileExtensionFieldConfig function. remove this the code from that function,

'validation' => [
    'required-entry' => true,

After execute php bin/magento cache:clean and check your admin panel.

I hope this will help you.

  • Editing directly a core file is not a good way. You should write a plugin or modify that option in the own class which will be injected in the global configuration (ui components pool of that form). Apr 2, 2018 at 11:27
  • getFileExtensionFieldConfig() Apr 2, 2018 at 11:33
  • Ill check in version 2.1.6 but its not required in than version, so can you tell me in which version its change to required Apr 2, 2018 at 11:36
  • Provide link if you have of change log Apr 2, 2018 at 11:39
  • In Magento2.1.6, it is by default non-require. Apr 2, 2018 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.