Skip to content

Instantly share code, notes, and snippets.

@schmengler
Last active September 2, 2022 16:23
Show Gist options
  • Star 43 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save schmengler/c42acc607901a887ef86b4daa7a0445b to your computer and use it in GitHub Desktop.
Save schmengler/c42acc607901a887ef86b4daa7a0445b to your computer and use it in GitHub Desktop.
Magento SUPEE-9767 Checkout Form Key Theme Patch
find -L app/design/frontend -regex '.*\(shipping\|billing\|shipping_method\|payment\).phtml' -exec grep -L formkey {} \; \
| xargs sed -i 's/<\/form>/<?php echo $this->getBlockHtml("formkey") ?><\/form>/g'
find -L skin/frontend -name 'opcheckout.js' -exec grep -L form_key {} \; \
| xargs sed -i 's/if (elements\[i\].name=='\''payment\[method\]'\'') {/if (elements[i].name=='\''payment[method]'\'' || elements[i].name == '\''form_key'\'') {/g'
@umeshtandel
Copy link

umeshtandel commented Jul 13, 2017

open your custom theme payment.phtml file
app/design/frontend/custompackage/customtheme/template/checkout/onepage/payment.phtml

cut the below code from 'co-payment-form'
<?php echo $this->getBlockHtml("formkey") ?>

and paste it above 'co-payment-form' form tag like

<?php echo $this->getBlockHtml("formkey") ?>
<form id='co-payment-form'>

This thing resolved my issue.

@diegoliliang
Copy link

diegoliliang commented Feb 6, 2018

@umeshtandel

<?php echo $this->getBlockHtml("formkey") ?> should put under <form id='co-payment-form'> , not above. Otherwise it will not work.

It should like:

<form id='co-payment-form' action="">
<?php echo $this->getBlockHtml("formkey") ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment