Skip to content

Commit fb31225

Browse files
author
Mohan Ahuja
committed
ACP2E-711: "Invalid Form Key. Please refresh the page." error occurs when changing the product limit in categories
- Added new function to get form_key from UI, if it doesn't exist in cookies.
1 parent 97eb9ae commit fb31225

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/code/Magento/PageCache/view/frontend/web/js/form-key-provider.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ define(function () {
5555
return null;
5656
}
5757

58+
function getFormKeyFromUI() {
59+
return document.querySelector(inputSelector).value;
60+
}
61+
5862
/**
5963
* Generate form key string
6064
* @private
@@ -79,7 +83,7 @@ define(function () {
7983
formKey = getFormKeyCookie();
8084

8185
if (!formKey) {
82-
formKey = generateFormKeyString();
86+
formKey = getFormKeyFromUI() || generateFormKeyString();
8387
setFormKeyCookie(formKey);
8488
}
8589
inputElements = document.querySelectorAll(inputSelector);

0 commit comments

Comments
 (0)