0

I have serious problems with custom Magento 2 theme and (probably) formkey cashing. I have 2 views of exactly same e-shop.

 - View 1: Luma Theme - View 2: Custom Theme (Luma child) - overriding layouts, phtml, styles and javascripts 

If cache is enabled and flushed everything -> adding/deleting from car works properly. After several minutes specified actions in View 2 (Custom theme) returns 302 status code and Magento redirects user to /cart page.

Now i discovered 3 ways how to "fix" this issue.

  1. Flush cache - only temporary solution for few minutes.
  2. Delete formKey validation from Magento core - totally inappropriate.
  3. Disable cache - affects performance.

I'm struggling with this problem couple of days and I will be glad for any advice.

2
  • You're trying localhost as the top level domain? Commented Jul 5, 2017 at 4:58
  • No, tld is eu or dev. View 1 with Luma works propertly. Commented Jul 7, 2017 at 5:42

2 Answers 2

0

Magento 2 - invalid form key occurs before of 2 reasons.

1) check your view source page, generated form_key and passing form_key are same. if not same need to fix it.

2) increase php_value max_input_vars 75000. Check your error log surely max_input_vars reached error will through.

Hope it will helpful for you

0

I had the same problem with magento 2.3, where Add to Cart button refreshed the page instead of adding anything in cart. where as website was working properly in Private Browsing on a custom theme.

Solutions Didn't Worked:

  • Change max_input_var=10000
  • max_input_time = 600
  • max_execution_time = 3600
  • Flush cache

Solution Worked for me:

In Configuration >> Web, I:

I am not sure if its a reliable fix or a temporary, but it resolved the issue for now.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.