Trying to figure out how to add a form key to your form? You’ll need to add Magento\Framework\Data\Form\FormKey class as a dependency to your Block, and get the form key from the method getFormKey().
Here’s a practical example:
Then in your template you can call getFormKey() method of blockformKey = $forKey parent::__construct($context, $data); } public function getFormKey() { return $this->formKey->getFormKey(); } }