2

I add some custom option in sample product. I save this product and add changes in custom option.

But I can not save the product. and get this error,

Invalid Form Key. Please refresh the page.

enter image description here

  • Try to re-login in magento 2 admin and again add custom options of product then save product.It should work. – akgola Jan 10 '18 at 4:55
  • It not work for me. I tried so many process but not save. @akgola – Dhaduk Mitesh Jan 10 '18 at 5:28
3

This problem is occurred after adding more custom options in the product because php.ini file not allowed to add more custom option.

So, required to change default settings of php.ini file.

Now, Edit your php.ini file.

If php version 7.1 then,

/etc/php/7.1/apache2/php.ini

If php version 7.0 then,

/etc/php/7.0/apache2/php.ini

Uncomment this value and update this all value in php.ini,

max_input_vars = 200000
max_input_time = 600
max_execution_time = 3600

Now Restart Apache 2 web server, and check it.

sudo service apache2 restart

  • I previously increased max_input_vars to 75000 but still sometimes it showing invalid form key error. Is I need to increase the values for max_input_time and max_execution_time too? – Kowsigan Atsayam Sep 12 at 10:00
  • Please set max_input_vars = 200000. – Dhaduk Mitesh Sep 24 at 13:20
  • I solved that issue. It was a different error that caused this issue. – Kowsigan Atsayam Sep 24 at 13:28
0

Re-login or else if you are developer then till development you can make this setting :

"Add Secret Key to URLs"->No.

Find below screen-shot for more clarity.

enter image description here

  • I tried but not working. I have so many custom option but not save the product. Have you any other solution? – Dhaduk Mitesh Jan 10 '18 at 6:08
  • Post your code so we can help you . – Pramod Kharade Jan 10 '18 at 6:49
  • I install Magento2.2.2 without sample data. Now I add new product and add custom option. After I save the new product. Now I change in custom option and tried to save again than the product not save and give invalid form key error. any idea? – Dhaduk Mitesh Jan 10 '18 at 7:02
  • I Would suggest don't go for magento 2.2.2 instead of it go with 2.2.2. 2.2.2 have some issues. – Pramod Kharade Jan 10 '18 at 7:16

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.