0

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,

http://prntscr.com/izo2fm

how to set it to not required

  • Have someone found real fix for this problem? – Mikg Sep 9 '18 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 – Jai Sep 9 '18 at 14:51
2

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" />
</config>

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). – Siarhey Uchukhlebau Apr 2 '18 at 11:27
  • getFileExtensionFieldConfig() – Ashish Ranade Apr 2 '18 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 – Jigs Parmar Apr 2 '18 at 11:36
  • Provide link if you have of change log – Jigs Parmar Apr 2 '18 at 11:39
  • In Magento2.1.6, it is by default non-require. – Dhaduk Mitesh Apr 2 '18 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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